Parçalar, Portallar ve DOM Sırası Tuzağı
Oluşturulan sıranın erişilebilirlik ağacıyla eşleşmesini sağlayın.
Parçalar, Portallar ve DOM Sırası Tuzağı, CoddyKit'te ücretsiz bir Web Accessibility Academy dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Web Accessibility Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Web Accessibility Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Source Order Is the Default Order
Screen readers and the keyboard follow the DOM order, the order elements appear in the document. CSS may move things visually, but reading order does not change.
Fragments Add No Extra Box
A React Fragment groups children without adding a wrapper div. That keeps your DOM clean and avoids breaking lists or tables with stray elements.
<>
<th>Name</th>
<th>Email</th>
</>Why a Wrapper div Can Hurt
An extra div inside a list or table can break the parent-child structure assistive tech expects. A Fragment avoids that invalid nesting entirely.
Portals Render Elsewhere
A Portal renders children into a different DOM node, often the document body. It is the standard way to mount modals above everything else.
createPortal(<Modal />, document.body);Portals Keep React Context
Even though the markup lands elsewhere, a portal stays in your component tree. State and context flow normally, so logic is unaffected.
The DOM Order Trap
A portal at the end of body can appear after unrelated content. Tabbing may jump to a far-off spot, so focus management becomes essential for portals.
Move Focus Into the Portal
When a portal opens, the keyboard does not follow automatically. Explicitly move focus into the modal so the user is where the new content is.
Trap and Return Focus
While a portal modal is open, keep Tab inside it. On close, return focus to the element that opened it, since DOM proximity will not do this for you.
Visual Order Versus Reading Order
CSS flexbox order or grid placement can rearrange the screen. The tab order still follows the source, so avoid reordering interactive content with CSS.
Keep Source Order Meaningful
Write your JSX so the source order matches the logical reading flow. Then both sighted and screen reader users encounter content in the same sensible sequence.
Test by Tabbing
Press Tab through your app and watch where focus goes. If it jumps somewhere unexpected, your DOM order or a portal needs attention.
Quick Check
You mount a modal with a portal into document.body. What new responsibility does that create?
Recap: Order and Portals
Use Fragments to avoid invalid wrappers, keep source order logical, and manage focus carefully whenever a portal renders content elsewhere. 🧩
Sıkça Sorulan Sorular
“Parçalar, Portallar ve DOM Sırası Tuzağı” dersi ücretsiz mi?
Evet — “Parçalar, Portallar ve DOM Sırası Tuzağı” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Web Accessibility Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Web Accessibility Academy kursu toplamda 4 dersten oluşur.
“Parçalar, Portallar ve DOM Sırası Tuzağı” dersinde ne öğreneceğim?
Oluşturulan sıranın erişilebilirlik ağacıyla eşleşmesini sağlayın. Web Accessibility Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Web Accessibility Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Web Accessibility Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.
“Parçalar, Portallar ve DOM Sırası Tuzağı” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Web Accessibility Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Web Accessibility Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Sayfayı Yenilemeden Rota Değiştirme
- Ref ve useEffect ile Odağı Yönetme
- Parçalar, Portallar ve DOM Sırası Tuzağı
- jsx-a11y ve Bileşen Düzeyinde Güvenceler