Skip to content

fix(Snackbar): announce toasts via persistent portal live regions - #774

Merged
johnleider merged 1 commit into
masterfrom
fix/snackbar-deferred-announcement-615
Aug 3, 2026
Merged

fix(Snackbar): announce toasts via persistent portal live regions#774
johnleider merged 1 commit into
masterfrom
fix/snackbar-deferred-announcement-615

Conversation

@johnleider

@johnleider johnleider commented Aug 3, 2026

Copy link
Copy Markdown
Member

Closes #615

Review of the sources replaced the original deferred-fill approach in this PR: the 100ms delay was unsourced (MDN recommends ≥2s for freshly-inserted regions), it coupled visible rendering to AT timing, and NVDA does not announce JS-injected role="status" regions (nvaccess/nvda#14591) — full rationale in #615 (comment). Announcement duty now lives in the persistent layer instead, per the tetralogical article's first recommendation.

  • Snackbar.Announcer (new sub-component, HiddenInput-style) — a visually-hidden announcer pair: polite (role="status") + assertive (role="alert"), both aria-atomic, mounted empty so the regions pre-exist any toast. Snackbar.Portal owns the announcement state and auto-renders it; :announcer="false" opts out for removal or explicit placement.
  • Snackbar.Root renders immediately (no deferral anywhere) and mirrors its rendered textContent into the matching announcer on the next tick via an optionally-injected Portal context; urgent routes to the assertive region, sidestepping the NVDA status-injection bug. Text is cleared before filling on the next frame (via useRaf) so identical consecutive messages re-announce, and rapid-fire announces coalesce to the latest message per region instead of queuing stale intermediates for SRs to speak.
  • SSR: announcers render empty on the server by definition; mirroring is client-only. No hydration mismatch possible.
  • Bare Snackbar.Root without a Portal: no announcer available — role attributes remain as documented best-effort (JS-injected status regions are unreliable, see role="status" live region not announced when injected into DOM nvaccess/nvda#14591).

Part 1 of #615 (the urgent prop / role="alert" path) landed in #624.

Sources: tetralogical — why are my live regions not working, adrianroselli — live region support, nvaccess/nvda#14591

@johnleider johnleider added this to the v1.0.x milestone Aug 3, 2026
@johnleider johnleider added T: bug Something isn't working C: Snackbar labels Aug 3, 2026
@johnleider johnleider self-assigned this Aug 3, 2026
@johnleider
johnleider force-pushed the fix/snackbar-deferred-announcement-615 branch from 34fbc74 to 8b9b622 Compare August 3, 2026 16:51
@johnleider johnleider changed the title fix(Snackbar): defer first live-region fill so initial announcement lands fix(Snackbar): announce toasts via persistent portal live regions Aug 3, 2026
@johnleider
johnleider force-pushed the fix/snackbar-deferred-announcement-615 branch from 8b9b622 to 9208368 Compare August 3, 2026 16:54
@johnleider
johnleider force-pushed the fix/snackbar-deferred-announcement-615 branch from 9208368 to eb5d54c Compare August 3, 2026 17:19
johnleider added a commit that referenced this pull request Aug 3, 2026
No ESLint rule enforces this header: grepping eslint.config.js and the
resolved eslint-config-vuetify output finds no Foundational subgroup in
the perfectionist/sort-imports groups. The comments were hand-written in
the original feature commits (e6dcb42, e601c19) and merely preserved
by perfectionist, which keeps comments attached to the import below them.

Remove the stray subgroup comments so the Composables section matches the
single-header norm used everywhere else. SnackbarRoot.vue keeps its copy
for now - it is being cleaned on the open PR #774 branch.

Verified: full pnpm lint:fix re-run does not re-insert the comments and
produces no other changes.
@johnleider
johnleider force-pushed the fix/snackbar-deferred-announcement-615 branch 2 times, most recently from 7423656 to 1b38d18 Compare August 3, 2026 17:53
@johnleider
johnleider force-pushed the fix/snackbar-deferred-announcement-615 branch from 1b38d18 to 2471895 Compare August 3, 2026 17:57
@johnleider
johnleider marked this pull request as ready for review August 3, 2026 18:00
@johnleider
johnleider merged commit 77f1f59 into master Aug 3, 2026
22 checks passed
@johnleider
johnleider deleted the fix/snackbar-deferred-announcement-615 branch August 3, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: Snackbar T: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Snackbar: no alert-role path and unreliable first announcement

1 participant