politeとassertive:緊急度を選ぶ
更新によってユーザーの操作を中断するかどうかを判断します。
「politeとassertive:緊急度を選ぶ」はCoddyKit上の無料Web Accessibility Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb Accessibility Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web Accessibility Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
What a Live Region Is
A live region is an element a screen reader watches, so it speaks any text that changes inside it without the user moving focus there.
Two Politeness Levels
The aria-live attribute has two useful values you will reach for constantly: polite and assertive. They decide how an update is delivered. 🔊
Polite Waits Its Turn
With polite, the screen reader finishes whatever it is saying, then reads your update. It never cuts the user off mid-sentence.
<div aria-live="polite">Draft saved</div>Assertive Interrupts Now
With assertive, the screen reader stops what it is reading and announces your update right away. Use it only when waiting would cost the user.
<div aria-live="assertive">Connection lost</div>Polite Is the Default Choice
Reach for polite almost every time. Save, sort, filter, and progress updates can all wait a beat without confusing anyone.
Save Assertive for Real Urgency
Use assertive only for things the user must hear immediately, like a failed payment or a session about to expire.
There Is Also Off
The value off tells the screen reader to ignore changes in that element. It is the implicit default for elements you have not marked as live.
<div aria-live="off">Silent updates</div>The Region Must Exist First
The live element should be in the DOM before the text changes. Screen readers watch existing regions, so add it empty and fill it later.
<div id="msg" aria-live="polite"></div>Change Text, Not the Region
Announce by updating the text content inside the existing region. Swapping the whole region out can make the announcement silently fail.
document.getElementById('msg').textContent = 'Saved';Assertive Can Pile Up
Fire several assertive updates fast and they fight each other, interrupting and talking over the last one. Polite queues them in order instead.
Match Urgency to Impact
Pick the level by asking how much an interruption helps. Most updates: polite. Errors and warnings the user must act on: assertive.
Quick Check
You add a small confirmation that a list was sorted. Which politeness level fits best?
Recap: Choosing Urgency
You learned that polite waits and assertive interrupts. Default to polite, reserve assertive for true urgency, and keep the region in the DOM. ✅
よくある質問
「politeとassertive:緊急度を選ぶ」レッスンは無料ですか?
はい。「politeとassertive:緊急度を選ぶ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web Accessibility Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web Accessibility Academyコースには全4レッスンが含まれています。
「politeとassertive:緊急度を選ぶ」で何を学びますか?
更新によってユーザーの操作を中断するかどうかを判断します。 ブラウザで直接実行するハンズオンコードでWeb Accessibility Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Web Accessibility Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのWeb Accessibility Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。
「politeとassertive:緊急度を選ぶ」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このWeb Accessibility Academyレッスンでコードを書いて実行できますか?
はい。すべてのWeb Accessibility Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- politeとassertive:緊急度を選ぶ
- status、alert、logロール
- トースト、ローダー、件数を通知する
- ライブリージョンが機能しない理由と修正方法