<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Islam Sayed on Medium]]></title>
        <description><![CDATA[Stories by Islam Sayed on Medium]]></description>
        <link>https://medium.com/@islam.sayed8?source=rss-266108a0dd33------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6y2MuMZaEkCkFFyZVyC4aQ.jpeg</url>
            <title>Stories by Islam Sayed on Medium</title>
            <link>https://medium.com/@islam.sayed8?source=rss-266108a0dd33------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:55:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@islam.sayed8/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[.htaccess]]></title>
            <link>https://medium.com/@islam.sayed8/htaccess-8011b03843fb?source=rss-266108a0dd33------2</link>
            <guid isPermaLink="false">https://medium.com/p/8011b03843fb</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Islam Sayed]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 15:48:07 GMT</pubDate>
            <atom:updated>2025-07-01T15:48:07.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myY-CvIiMitK5tzb2vjmNA.jpeg" /><figcaption>.htaccess</figcaption></figure><p>If you’ve worked mostly in React or front-end environments, .htaccess might sound like something from a backend world—and you&#39;d be right. But if your app is hosted on an Apache web server, this tiny file can be <em>absolutely essential</em> for making your React app work properly after deployment.</p><p>So, what is it?</p><p><strong>.htaccess</strong> is a <strong>configuration file</strong> used by <strong>Apache</strong>, one of the most common web servers. The name stands for &quot;<strong>hypertext access</strong>&quot;. It lets you control how the server behaves, but only within the folder it&#39;s placed in.</p><h4>Why Should a Front-End Developer Care?</h4><p>Imagine this:</p><p>You’ve built a slick React app with React Router. Your routes look like:</p><ul><li>/</li><li>/dashboard</li><li>/profile/settings</li></ul><p>You deploy it to an Apache server. Everything works fine <strong>until</strong> your users refresh the page or paste a deep link directly in the browser.</p><p>Suddenly… <strong>404 Not Found.</strong> Why?</p><h3>How Apache Thinks</h3><p>Apache was designed in the old days of static files — HTML, CSS, JS. When someone visits /dashboard, Apache thinks:</p><blockquote><strong><em>“Hmm, I’ll look for a folder or file named </em></strong><strong><em>dashboard. Can’t find it? Okay, 404 it is.”</em></strong></blockquote><p>But we, as React developers, know that /dashboard is a <em>React route</em>, not a file or folder. The app is supposed to load index.html, and the routing should be handled in the browser by React Router.</p><p>That’s where .htaccess comes in. It tells Apache:</p><blockquote><strong><em>“Hey, if you don’t find a real file or folder, just serve </em></strong><strong><em>index.html anyway. The app will take care of the rest.”</em></strong></blockquote><h4>What Goes Inside .htaccess?</h4><p>Here’s the version you’ll often see in React apps:</p><pre>RewriteEngine On<br>RewriteBase /<br>RewriteRule ^index\.html$ - [L]<br>RewriteCond %{REQUEST_FILENAME} !-f<br>RewriteCond %{REQUEST_FILENAME} !-d<br>RewriteRule . /index.html [L]</pre><p>Let’s break that down in plain English:</p><ul><li>RewriteEngine On → Turn on the magic (mod_rewrite).</li><li>RewriteBase / → Tell Apache where your app base starts (usually the root).</li><li>RewriteRule ^index\.html$ - [L] → Don’t mess with index.html if it’s directly requested.</li><li>RewriteCond %{REQUEST_FILENAME} !-f → If it’s <strong>not</strong> a real file...</li><li>RewriteCond %{REQUEST_FILENAME} !-d → ...and it’s <strong>not</strong> a real directory...</li><li>RewriteRule . /index.html [L] → Then just serve index.html instead.</li></ul><p>This setup ensures that:</p><blockquote>A<strong>ny unknown route still loads your React app</strong>, and then <strong>React Router takes care of rendering the right page.</strong></blockquote><h4>Where Should You Put .htaccess?</h4><p>In a React project, especially with Vite or Create React App, you put .htaccess in the public/ folder.</p><p>Why?</p><p>Because during the build process (npm run build or vite build), the public/ folder gets copied into your final dist/ or build/ folder, which is what goes to the server.</p><p>So public/.htaccess becomes dist/.htaccess, and Apache can find and use it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8011b03843fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Do We Write <! DOCTYPE html> ?]]></title>
            <link>https://medium.com/@islam.sayed8/why-do-we-write-doctype-html-fe2797a3f1c8?source=rss-266108a0dd33------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe2797a3f1c8</guid>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Islam Sayed]]></dc:creator>
            <pubDate>Tue, 12 Mar 2019 10:27:58 GMT</pubDate>
            <atom:updated>2019-03-12T10:27:58.587Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*vqWWFAz_gdVL81WjM_AKRQ.jpeg" /></figure><h3>Why Do We Write &lt;! DOCTYPE html&gt; ?</h3><h4>Yes, this is for the absolute beginner, and also for those non-beginners who forgot. I am going to look back behinds and re-discover things we take as granted by asking “WHAT”, “WHY”, and “HOW” .</h4><h3>Why do we write &lt;! DOCTYPE html&gt; ?</h3><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>    &lt;head&gt;<br><br>    &lt;/head&gt;<br>    &lt;body&gt;<br><br>    &lt;/body&gt;<br>&lt;/html&gt;</pre><p>&lt;! DOCTYPE html&gt;is the first html tag written at the beginning of any html file. It is not an element and doesn’t has content or closing tag.<br>Its job is to tell the browser that the document being rendered is an HTML document. That’s the reason for its position to be the first thing the browser read.</p><h3>But what would happen if we didn’t write it?</h3><p>If browser didn’t find a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Doctype">DOCTYPE</a> declaration, it would enter <a href="https://en.m.wikipedia.org/wiki/Quirks_mode">quirks mode</a>🤔 which is a technique used by browsers to try to support old web pages that has been made for Navigator 4 and Internet Explorer 5. <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Quirks_Mode_and_Standards_Mode">Read about it here</a>.</p><p>This means that your website will have different behavior and look with different browsers especially if it has new HTML elements and features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe2797a3f1c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Trap Focus Inside a Modal]]></title>
            <link>https://medium.com/@islam.sayed8/trap-focus-inside-a-modal-aa5230326c1b?source=rss-266108a0dd33------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa5230326c1b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tab-order]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[trap-focus]]></category>
            <dc:creator><![CDATA[Islam Sayed]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 09:33:09 GMT</pubDate>
            <atom:updated>2019-02-06T10:38:09.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0OFJyrlpR-1pgi1E" /><figcaption>“bottom view of concrete spiral stair” by <a href="https://unsplash.com/@mommist?utm_source=medium&amp;utm_medium=referral">Len dela Cruz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Trapping focus is one of the important issues concerning accessibility. In case of assistive technology (like screen readers) users, or keyboard users, trapping focus is a must.</p><p>We are going to talk about How to Trap Focus inside of a modal as long as it is open and transfer focus to the rest of page once it is closed.</p><p>You can either read the whole article or just scroll to the section of code if you are in a hurry and know what is before it.</p><p>Let’s see what we have here.</p><blockquote>Contents:</blockquote><ol><li>Terminology.</li><li>tabindex Attribute.</li><li>Element.focus()</li><li>Trap Focus method</li><li>Resources.</li></ol><blockquote><strong>Terminology:</strong></blockquote><p>According to <a href="https://allyjs.io/what-is-focusable.html">Ally.js</a> library an HTML element can be a member of exactly one of the following five categories:</p><p><strong><em>Inert</em></strong>: The element is not interactive and thus not focusable. And should not be focused by script (except in rare cases).</p><p><strong><em>Focusable</em></strong>: The element can be focused by script Element.focus() and possibly the mouse (or pointer), but not the keyboard.</p><p><strong><em>Tabbable</em></strong>: The element is keyboard focusable (“tabbable”), as it is part of the document’s sequential focus navigation order. The element is also focusable by script and possibly the mouse (or pointer). It is important to note that this navigation order is the same as DOM order.</p><p><strong><em>Only Tabbable</em></strong>: The element is <em>only</em> keyboard focusable, possibly by the mouse (or pointer), but it cannot be focused by script.</p><p><strong><em>Forward Focus</em></strong><em>: </em>The element will forward focus to another element instead of receiving focus itself.</p><p>Here is a <a href="https://allyjs.io/data-tables/focusable.html">table</a> of Browser Compatibility of Focusable and Tabbable Elements. It shows which elements are tabbable, focusable, or inert and its compatibility with different browsers.</p><blockquote><strong>tabindex Attribute:</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*S7tATeklsnqjLbRxExdcBg.jpeg" /></figure><p>The attribute tabindex is a global HTML attribute. It decides which element could be focused and puts it in the sequential focus navigation order (or simply tab order).</p><p>Its value can be one of three:</p><ol><li><strong><em>Negative value</em></strong>: tabindex=&quot;-1&quot; removes the element from tab order but it can be focusable by script.</li><li><strong><em>Zero value</em></strong>: tabindex=&quot;0&quot; put the element in the tab order and its order is affected by to DOM structure. Note that the visual (CSS) structure does not affect tab order. Therefore, it is a good practice to have a similar viasual and DOM order not to confuse keyboard users.</li><li><strong><em>Positive value</em></strong>: tabindex=&quot;1&quot; meaning that the element should be focusable in sequential keyboard navigation, with its order defined by the value of the number in an ascending manner. So tabindex=&quot;2&quot; will precede tabindex=&quot;3&quot; . This is Anti-Pattern and should be avoided because you will end up jumping between elements and this would cause confusion.</li></ol><blockquote><strong>Element.focus():</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L--6TZpT4-ZUnR3ginId8w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/dGqWUPPesrQ?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Chase Clark</a> on <a href="https://unsplash.com/search/photos/focus-hand?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>It sets focus on a specified element. This does not mean that it outs the element in the tab order, but it drags focus to it in a certain event using script. It can be used to a focusale or not unfocusable element.</p><p>Syntax:</p><p>Element.focus([option])</p><p>The optional focus option is a boolean value.</p><p>If falsemethod will scroll the element into the visible area of the browser window.</p><p>If true(default) method will not scroll the element into the visible area of the browser window.</p><blockquote><strong>Trap Focus Method:</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ofMfrqFMfpaTH_RMvI_RQA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/95YRwf6CNw8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clément H</a> on <a href="https://unsplash.com/search/photos/javascript?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Here comes the exciting part. In this article we will tackle trapping focus inside a modal using JavaScript Of course, it is not the only method.</p><p>This a simple page example contains:</p><ol><li><em>Sign in</em> button. It is not a button in fact. It is just a div acts like a button. That’s why I added tabindex=&quot;0&quot; attribute to it.</li><li><em>Form </em>consists of a Text box and a button.</li><li><em>Modal that pops up </em>when you click S<em>ign in</em> button or press enter while it is focused. It contains:</li><li><em>Two Text boxes</em>. One for user name and the second for password entry. And finally a L<em>og in</em> button.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fislam8%2Fembed%2Fpreview%2FBPvazR%3Fheight%3D600%26slug-hash%3DBPvazR%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fislam8%2Fpen%2FBPvazR&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1572728.BPvazR.small.72a85e4f-d251-4d4a-a3d0-56339301251f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/696a8254031caa62b14396145f10885a/href">https://medium.com/media/696a8254031caa62b14396145f10885a/href</a></iframe><p>The required behavior is that when the modal is open focus is trapped inside it and does not reach other elements until modal is closed.</p><p>What did I do?</p><ol><li>When the <em>Sign in</em> button is clicked or pressed “Enter” upon, I opened modal, remove elements outside modal from tab order, and start focusing on the first focusable element of modal.</li><li>Inside modal I took care of the first and last focusable elements, to ensure that when user reaches the last element for example the first element will be the target of the next tab, and when user presses “shift+tab” while on first element, it will bring focus to the last element. So Focus is trapped inside the modal as long as it is open.</li><li>When user click or press “Enter” while on <em>Log on</em> button, the modal disappears, and all other elements return focusable again.</li></ol><blockquote><strong>Resources:</strong></blockquote><p><a href="https://gomakethings.com/how-to-get-the-first-and-last-focusable-elements-in-the-dom/">How to get the first and last focusable element in the DOM</a>.</p><p><a href="https://allyjs.io/data-tables/focusable.html">Focusable Elements — Browser compatibility table</a>.</p><p><a href="https://allyjs.io/what-is-focusable.html">What does Focusable mean?</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus">HTMLElement.focus(</a>)</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute">Element.removeAttribute()</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/NodeList">NodeList</a>.</p><p><a href="https://medium.com/@melwinalm/crcreating-keyboard-shortcuts-in-javascripteating-keyboard-shortcuts-in-javascript-763ca19beb9e">Creating keyboard shortcuts using JavaScript</a>.</p><p><a href="https://stackoverflow.com/questions/2694640/find-an-element-in-dom-based-on-an-attribute-value#16775485">Find Element based on Attribute Value</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa5230326c1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>