Skip to content

Commit 1f6dd0e

Browse files
authored
fix: make the aria live region assertive (#9436)
1 parent 7e77b10 commit 1f6dd0e

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

core/inject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function inject(
8686
const ariaAnnouncementSpan = document.createElement('span');
8787
ariaAnnouncementSpan.id = 'blocklyAriaAnnounce';
8888
dom.addClass(ariaAnnouncementSpan, 'hiddenForAria');
89-
aria.setState(ariaAnnouncementSpan, aria.State.LIVE, 'polite');
89+
aria.setState(ariaAnnouncementSpan, aria.State.LIVE, 'assertive');
9090
subContainer.appendChild(ariaAnnouncementSpan);
9191

9292
return workspace;

core/utils/aria.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,20 +202,20 @@ export function getState(element: Element, stateName: State): string | null {
202202
}
203203

204204
/**
205-
* Softly requests that the specified text be read to the user if a screen
205+
* Assertively requests that the specified text be read to the user if a screen
206206
* reader is currently active.
207207
*
208-
* This relies on a centrally managed ARIA live region that should not interrupt
209-
* existing announcements (that is, this is what's considered a polite
210-
* announcement).
208+
* This relies on a centrally managed ARIA live region that is hidden from the
209+
* visual DOM. This live region is assertive, meaning it will interrupt other
210+
* text being read.
211211
*
212212
* Callers should use this judiciously. It's often considered bad practice to
213-
* over announce information that can be inferred from other sources on the
214-
* page, so this ought to only be used when certain context cannot be easily
213+
* over-announce information that can be inferred from other sources on the
214+
* page, so this ought to be used only when certain context cannot be easily
215215
* determined (such as dynamic states that may not have perfect ARIA
216216
* representations or indications).
217217
*
218-
* @param text The text to politely read to the user.
218+
* @param text The text to read to the user.
219219
*/
220220
export function announceDynamicAriaState(text: string) {
221221
const ariaAnnouncementSpan = document.getElementById('blocklyAriaAnnounce');

0 commit comments

Comments
 (0)