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
constannouncer = newLiveAnnouncer(document, "orders-live", newSimpleDomService()); announcer.announce("Orders loaded"); // later announcer.destroy();
Delay in ms before a message is written (default for announce).
Methods
announce
announce(text, delayInMs?): void
Speaks a message (replaces a message that is still waiting).
Parameters
text: string
plain text
OptionaldelayInMs: number = LiveAnnouncer.defaultDelayInMs
wait this long before the text is written
Returns void
cancel
cancel(text?): 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
Optionaltext: string
only this message is dropped
Returns void
Since
1.1.92
destroy
destroy(): void
Cancels a waiting message and removes the live region from the document.
Returns void
getElement
getElement(): undefined | HTMLElement
The live region element (created on the first call).
Returns undefined | HTMLElement
undefined without a document body (e.g. server side rendering)
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: arole="grid"may only contain rows, and the body is never managed by a framework. The table creates it infirstInit()– 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 byTableScope.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
Since
1.1.91