التنقل بين علامات التبويب بمفاتيح الأسهم
اسمحوا للمستخدمين بالتنقل بين علامات التبويب باستخدام لوحة المفاتيح
التنقل بين علامات التبويب بمفاتيح الأسهم درس مجاني في Web Accessibility Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Accessibility Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Tabs Are Not Just Clickable
A correct tab set is driven by the keyboard, not the mouse alone. The APG pattern expects arrow keys to move between tabs.
The Tablist Is One Tab Stop
Pressing Tab should land on the tab set just once, not stop on every tab. The whole tablist behaves as a single stop in the page order.
Only One Tab Is Tabbable
Give the active tab tabindex="0" and every other tab tabindex="-1". This is the roving tabindex that keeps Tab from hitting them all.
<button role="tab" tabindex="0">Profile</button>Arrow Keys Move Focus
Inside a horizontal tablist, Right and Left arrows move focus from tab to tab. This is how keyboard users explore the set.
Up and Down for Vertical Tabs
If your tabs stack vertically, use Up and Down arrows instead. Set aria-orientation="vertical" so assistive tech knows the layout.
<div role="tablist" aria-orientation="vertical">...</div>Wrap Around at the Ends
When focus is on the last tab and the user presses the next arrow, wrap back to the first. Looping keeps navigation smooth and predictable.
Home and End Jump Far
Add two shortcuts: Home moves focus to the first tab and End moves it to the last. Long tab sets become much faster to navigate.
Move the Roving Index
When an arrow shifts focus, update the tabindex: set the newly focused tab to 0 and the old one to -1, then call focus on it.
newTab.tabIndex = 0; oldTab.tabIndex = -1; newTab.focus();Automatic Activation
With automatic activation, focusing a tab also selects it and shows its panel. It feels instant but can be heavy if panels are costly.
Manual Activation
With manual activation, arrows only move focus; the user presses Enter or Space to select. Prefer this when revealing a panel is expensive.
Why This Matters
Without arrow support, keyboard users must Tab through every tab and panel. Proper key handling makes the widget efficient, not just reachable.
Quick Check
Focus is on a tab in a horizontal tablist. The user presses the Right arrow. What should happen?
Recap: Arrow Navigation
You learned tabs use a roving tabindex with arrow keys, plus Home and End. Choose automatic or manual activation based on panel cost.
الأسئلة الشائعة
هل درس «التنقل بين علامات التبويب بمفاتيح الأسهم» مجاني؟
نعم — نص درس «التنقل بين علامات التبويب بمفاتيح الأسهم» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Accessibility Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
ماذا ستتعلم في «التنقل بين علامات التبويب بمفاتيح الأسهم»؟
اسمحوا للمستخدمين بالتنقل بين علامات التبويب باستخدام لوحة المفاتيح تتمرن على Web Accessibility Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Web Accessibility Academy؟
لا تُشترط خبرة سابقة. Web Accessibility Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «التنقل بين علامات التبويب بمفاتيح الأسهم»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Web Accessibility Academy هذا؟
نعم. كل درس في Web Accessibility Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- نمط علامات التبويب: tablist وtab وtabpanel
- التنقل بين علامات التبويب بمفاتيح الأسهم
- لوحات الأكورديون باستخدام Button وaria-expanded
- العنصر القابل للكشف أم علامات التبويب: اختاروا الأنسب