Skip to main content

blockly > utils > aria > announceDynamicAriaState

utils.aria.announceDynamicAriaState() function

Requests that the specified text be read to the user if a screen reader is currently active.

This relies on a centrally managed ARIA live region that is hidden from the visual DOM. This live region is designed to try and ensure the text is read, including if the same text is issued multiple times consecutively. Note that initializeGlobalAriaLiveRegion must be called before this can be used.

Callers should use this judiciously. It's often considered bad practice to over-announce information that can be inferred from other sources on the page, so this ought to be used only when certain context cannot be easily determined (such as dynamic states that may not have perfect ARIA representations or indications).

Signature:

export declare function announceDynamicAriaState(text: string, options?: DynamicAnnouncementOptions): void;

Parameters

Parameter

Type

Description

text

string

The text to read to the user.

options

DynamicAnnouncementOptions

(Optional) Custom options to configure the announcement. This defaults to the status role and polite assertiveness.

Returns:

void