الحالات والخصائص: موسّع، محدد، معطّل
عبّروا عن الحالة الحالية لعنصر التحكم
الحالات والخصائص: موسّع، محدد، معطّل درس مجاني في Web Accessibility Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Accessibility Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Beyond What, Toward How
A role says what an element is. States and properties say how it currently behaves: is it open, checked, busy, or off-limits?
States Change, Properties Mostly Stay
A state shifts as the user interacts, like expanded toggling. A property tends to stay put, like a control's required flag.
aria-expanded for Toggles
aria-expanded tells users whether a control's region is open. You must flip it in JavaScript every time the state changes.
<button aria-expanded="false">Menu</button>aria-checked for Custom Controls
aria-checked reports whether a custom checkbox or switch is on. A native checkbox already announces this for free.
<div role="switch" aria-checked="true">Dark mode</div>Disabled the Native Way
On real form controls, the HTML disabled attribute removes them from focus and announces them as unavailable automatically.
<button disabled>Submit</button>aria-disabled for the Rest
aria-disabled announces a custom control as disabled, but it does not block clicks. You still must stop the action in code.
<div role="button" aria-disabled="true">Submit</div>aria-selected in Sets
aria-selected marks the chosen item in a tablist, listbox, or grid so users know which option is currently active.
<div role="tab" aria-selected="true">Inbox</div>aria-pressed for Toggle Buttons
A toggle button uses aria-pressed to report on or off, like a bold button that stays lit while text is bold.
<button aria-pressed="true">Bold</button>Keep States in Sync
The number one bug: stale states. If the visual changes but aria-expanded stays false, screen reader users hear the wrong thing.
Values, Not Just Booleans
Some states carry numbers. A slider exposes its position with aria-valuenow, plus aria-valuemin and aria-valuemax for range.
<div role="slider" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"></div>aria-required and aria-invalid
Two helpful form properties: aria-required flags a must-fill field, and aria-invalid announces one that failed validation.
<input aria-required="true" aria-invalid="true">Quick Check
You build a custom accordion button. Which attribute reports whether its panel is open?
Recap: Report the State
You learned states and properties describe an element's condition. Prefer native attributes, and always keep ARIA states in sync with the UI.
الأسئلة الشائعة
هل درس «الحالات والخصائص: موسّع، محدد، معطّل» مجاني؟
نعم — نص درس «الحالات والخصائص: موسّع، محدد، معطّل» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Accessibility Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
ماذا ستتعلم في «الحالات والخصائص: موسّع، محدد، معطّل»؟
عبّروا عن الحالة الحالية لعنصر التحكم تتمرن على Web Accessibility Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Web Accessibility Academy؟
لا تُشترط خبرة سابقة. Web Accessibility Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «الحالات والخصائص: موسّع، محدد، معطّل»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Web Accessibility Academy هذا؟
نعم. كل درس في Web Accessibility Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- القاعدة الأولى: لا ARIA أفضل من ARIA سيئة
- الأدوار تحدد ماهية الشيء
- الحالات والخصائص: موسّع، محدد، معطّل
- قراءة شجرة إمكانية الوصول لتصحيح ARIA