Skip to content

fix(a11y): announce service detail error banners with role="alert" - #9

Open
nusendra wants to merge 1 commit into
mainfrom
fix/service-detail-error-role-alert
Open

nusendra wants to merge 1 commit into
mainfrom
fix/service-detail-error-role-alert

Conversation

@nusendra

Copy link
Copy Markdown
Owner

What

Adds role="alert" to the two error banners on the service detail page
(frontend/src/routes/services/[slug]/+page.svelte): the failed to load
template
banner and the install failed banner.

-<div class="error">{error}</div>
+<div class="error" role="alert">{error}</div>

Why

Both banners were rendered visually but announced to nothing. They are injected
into an already-loaded page, and a bare <div> is not a live region — so a
screen reader user who triggered an install failure received no notification
that anything had gone wrong. The failure was silent to exactly the users least
able to infer it from context.

role="alert" makes each an assertive live region, announced on insertion.

This is the existing house convention rather than a new pattern:
lib/components/Toast.svelte:7 already does the same thing.

Visual impact

None. role is semantics only; the .error class and all styling are
untouched. Verified present as a live alert node in the CDP accessibility tree.

Gates

  • npm run build — clean, adapter-static.
  • npm run check — 2 errors / 52 warnings, all pre-existing in
    lib/index.ts:4 and applications/[id]/+page.svelte:1137. Zero diagnostics
    in the touched file. Deliberately not fixed here.

Provenance

The change itself was authored under card t_6d808cb4 and then stranded as an
uncommitted diff in the shared checkout, where it survived one near-miss during
an unrelated rebase. This PR commits it on its own branch cut from origin/main
so it stops being a change waiting to be lost.

The service detail page renders two error banners -- "failed to load
template" and "install failed" -- as plain <div class="error">. They were
rendered visually but announced to nothing: a screen reader user who
triggered an install failure got no notification that anything had gone
wrong, because the banner is injected into an already-loaded page and a
bare div is not a live region.

Adding role="alert" makes both an assertive live region, so the message is
announced when it appears. This is the existing house convention -- see
lib/components/Toast.svelte:7, which already does exactly this.

Zero visual change: role is semantics only and the .error class is
untouched. Verified present as a live alert node in the CDP accessibility
tree.

Gates: `npm run build` clean (adapter-static). `npm run check` reports 2
errors / 52 warnings, all pre-existing in lib/index.ts:4 and
applications/[id]/+page.svelte:1137; zero diagnostics in the touched file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant