Skip to main content
cngx-src documentation

CngxMenuAnnouncer

Injectablev0.1.0WCAG AA

projects/common/interactive/menu/menu-announcer.ts

Import#

import { CngxMenuAnnouncer } from '@cngx/common/interactive'

Description#

Global polite live-region announcer for the menu family. Maintains a single hidden aria-live="polite" element per document and announces menu state transitions (submenu open/close, item activation).

Scoped providedIn: 'root' so every menu in the app shares the same region; messages are de-duped via a short clear-then-set cycle so screen readers treat repeated identical messages as fresh events.

Default factory output for CNGX_MENU_ANNOUNCER_FACTORY. Consumers obtain the announcer via the factory token, never by inject(CngxMenuAnnouncer) directly, so a swap is enterprise-wide.

Index#

Methods

Methods#

announce#void
announce(message: string)

Announce a message via the polite live region. Empty messages are ignored. The region is cleared ~16ms before being repopulated so AT picks up identical-text repeats as a new event.

@parammessagestring