A polite live region (role="status") that lets screen readers speak short messages: "Sorted by Total, descending", "42 rows", "12 cells copied" … Every table has one (TableApi.announce).

The element lives in document.body, not in the table: a role="grid" may only contain rows, and the body is never managed by a framework. The table creates it in firstInit() – before the first message. Known limit: inside a modal dialog (aria-modal="true") screen readers ignore content outside the dialog; announce such messages with a live region of your own in the dialog. It is visually hidden (inline styles – it works without the table CSS, e.g. outside a shadow root) and removed by destroy (called by TableScope.destroy()).

The text is written with textContent (never HTML). It is set after a short delay and the region is emptied first, so the same message is announced again, and a burst of messages (typing in a filter field) ends with one announcement of the last one.

Example

const announcer = new LiveAnnouncer(document, "orders-live", new SimpleDomService());
announcer.announce("Orders loaded");
// later
announcer.destroy();

Since

1.1.91

Hierarchy

  • LiveAnnouncer

Constructors

Properties

defaultDelayInMs: number = 150

Delay in ms before a message is written (default for announce).

Methods

  • Speaks a message (replaces a message that is still waiting).

    Parameters

    • text: string

      plain text

    • Optional delayInMs: number = LiveAnnouncer.defaultDelayInMs

      wait this long before the text is written

    Returns void

  • Drops a message that is still waiting (not spoken yet) – only if it is text (or any message without text). Used when the reason for the message is gone, e.g. "Loading…" after the data arrived.

    Parameters

    • Optional text: string

      only this message is dropped

    Returns void

    Since

    1.1.92

  • The live region element (created on the first call).

    Returns undefined | HTMLElement

    undefined without a document body (e.g. server side rendering)