Skip to main content
cngx-src documentation

createTabNavAnnouncement

Functioncommon/tabs/announcementsv0.1.0WCAG AA

projects/common/tabs/announcements/tab-nav-announcement.ts

Description#

Live-region content for the link-driven nav flavour: the active link's accessible label, announced only when the active id actually changes.

Why this is not createTabGroupAnnouncements. That bundle's phrasing is built around the commit lifecycle (pending -> success, rollback, direction prefix) and it gates on the commit transition, so it stays silent at rest for free. The nav path is commit-free by design: links navigate through their own routerLink and nothing calls presenter.select(). Its only meaningful announcement is the landing label, and it needs a different silence gate.

The mount window. announcing stays false through the first render and the microtask after it. On a deep link the active link is the page's initial state, not a change, and the browser already announces the document; pushing the landing section into a polite region there is noise. queueMicrotask rather than the afterNextRender body: every afterNextRender callback for one render runs in a single synchronous batch, so deferring past it makes the gate independent of whether a [cngxTabsRouteSync] seed registered before or after this one.

The prior-id tracker is seeded when that window closes, not at construction, so whatever the seed resolved counts as the starting point instead of as the first announcement. Returning to a section that was active at mount still announces.

Signature#

createTabNavAnnouncement(options: CngxTabNavAnnouncementOptions)

Parameters#

Returns#

CngxTabNavAnnouncement