أدوار status وalert وlog
اختاروا الدور الحي المناسب لكل نوع من التحديثات
أدوار status وalert وlog درس مجاني في Web Accessibility Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Accessibility Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Roles Build In Politeness
Some ARIA roles turn an element into a live region for you, setting a sensible politeness level automatically so you write less markup.
role status Is Polite
The status role marks a region that updates politely. It is perfect for low-key confirmations like a saved or copied message. 📋
<div role="status">Copied to clipboard</div>status Means aria-live polite
Using role status is shorthand for aria-live set to polite. You get the same behavior with clearer, more semantic intent.
role alert Is Assertive
The alert role announces assertively the instant its content appears. Reach for it when something needs attention right now. ⚠️
<div role="alert">Payment failed</div>alert Means aria-live assertive
An alert behaves like aria-live assertive plus aria-atomic true. It interrupts and reads its whole text as one message.
role log Is for Streams
The log role suits content where new entries get added in order, like a chat thread or an activity feed. It reads politely.
<ul role="log" aria-live="polite"></ul>log Preserves Order
A log signals that older messages matter and sequence is meaningful, so assistive tech reads additions in the order they arrive.
Status vs Alert in Practice
Pick status for a gentle confirmation and alert for a problem. A saved badge is status; a form-blocking error is alert.
Alerts Should Be Earned
Overusing the alert role makes everything interrupt and feel noisy. Reserve it for genuine errors and time-sensitive warnings.
Place the Role Before Content
Like raw live regions, an element with role status should exist before you inject text, so the screen reader is already watching it.
<p role="status" id="out"></p>Roles Add Meaning Too
Beyond politeness, these roles describe what the region is. That semantic clarity helps both screen readers and the next developer.
Quick Check
You need to announce a form submission error that blocks the user immediately. Which role fits?
Recap: Live Roles
You now know status is polite, alert is assertive, and log keeps ordered streams. Choose the role that matches the update's weight. ✅
الأسئلة الشائعة
هل درس «أدوار status وalert وlog» مجاني؟
نعم — نص درس «أدوار status وalert وlog» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Accessibility Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Web Accessibility Academy 4 دروس في المجموع.
ماذا ستتعلم في «أدوار status وalert وlog»؟
اختاروا الدور الحي المناسب لكل نوع من التحديثات تتمرن على Web Accessibility Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Web Accessibility Academy؟
لا تُشترط خبرة سابقة. Web Accessibility Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «أدوار status وalert وlog»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Web Accessibility Academy هذا؟
نعم. كل درس في Web Accessibility Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- polite أم assertive: اختيار درجة الإلحاح
- أدوار status وalert وlog
- الإعلان عن Toasts وأدوات التحميل والعدادات
- لماذا تفشل المناطق الحية وكيفية إصلاحها