Class

AriaLiveAnnouncer (ui)

@ckeditor/ckeditor5-ui/src/arialiveannouncer

class

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

Methods

  • constructor( editor )

    Parameters

    editor : Editor
  • announce( regionName, announcementText, politeness ) → void

    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