Skip to main content

@lexical/react/useAriaLiveRegion

Interfaces

AriaLiveRegionOptions

Defined in: packages/lexical-react/src/useAriaLiveRegion.ts:13

Properties

owner?

optional owner?: HTMLElement

Defined in: packages/lexical-react/src/useAriaLiveRegion.ts:26

Owner element to append the live region to. Defaults to document.body. Passing a specific element keeps the region in the same accessibility subtree as the editor when the editor lives inside a shadow root or a portaled overlay.

politeness?

optional politeness?: AriaPoliteness

Defined in: packages/lexical-react/src/useAriaLiveRegion.ts:19

How insistently the screen reader announces updates.

  • polite (default): announce after the current speech completes.
  • assertive: interrupt the current speech.

Type Aliases

AriaPoliteness

AriaPoliteness = "polite" | "assertive"

Defined in: packages/lexical-react/src/useAriaLiveRegion.ts:11

Functions

useAriaLiveRegion()

useAriaLiveRegion(options?): (message) => void

Defined in: packages/lexical-react/src/useAriaLiveRegion.ts:51

Mounts a visually hidden aria-live region and returns an announce function that writes a message into it. The region is created on mount, removed on unmount, and lives inside owner (default document.body).

Calling announce with the same string back-to-back appends a zero-width space so screen readers register the change and re-announce. WAI-ARIA status message pattern (WCAG 4.1.3).

Parameters

options?

AriaLiveRegionOptions = {}

Returns

(message) => void