AriaLiveAnnouncer (ui)
@ckeditor/ckeditor5-ui/src/arialiveannouncer
An accessibility helper that manages all ARIA live regions associated with an editor instance. ARIA live regions announce changes to the state of the editor features.
These announcements are consumed and propagated by screen readers and give users a better understanding of the current state of the editor.
To announce a state change to an editor feature named 'Some feature'
, use the announce
method:
editor.ui.ariaLiveAnnouncer.announce( 'Some feature', 'Text of an announcement.' );
Filtering
Properties
-
The editor instance.
-
view : AriaLiveAnnouncerView | undefined
module:ui/arialiveannouncer~AriaLiveAnnouncer#view
The view that aggregates all
aria-live
regions.
Methods
-
constructor( editor )
module:ui/arialiveannouncer~AriaLiveAnnouncer#constructor
-
announce( regionName, announcementText, politeness ) → void
module:ui/arialiveannouncer~AriaLiveAnnouncer#announce
Sets an announcement text to an aria region associated with a specific editor feature. The text is then announced by a screen reader to the user.
If the aria region of a given name does not exist, it will be created and can be re-used later. The name of the region groups announcements originating from a specific editor feature and does not get announced by a screen reader.
Using multiple regions allows for many announcements to be emitted in a short period of time. Changes to ARIA-live announcements are captured by a screen reader and read out in the order they were emitted.
The default announcement politeness level is
'polite'
.// Most screen readers will queue announcements from multiple aria-live regions and read them out in the order they were emitted. * editor.ui.ariaLiveAnnouncer.announce( 'image', 'Image uploaded.' ); * editor.ui.ariaLiveAnnouncer.announce( 'network', 'Connection lost. Reconnecting.' ); * ```
Parameters
regionName : string
announcementText : string
politeness : 'polite' | 'assertive'
-
Defaults to
AriaLiveAnnouncerPoliteness.POLITE
Returns
void
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.