Skip to content

a11y: make the results panel an ARIA live region#41

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-1esahm
Open

a11y: make the results panel an ARIA live region#41
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-1esahm

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

Clicking Calculate Infrastructure replaces the results placeholder with the sizing cards via innerHTML, but the results panel had no live-region semantics. Screen readers therefore announced nothing — a non-sighted user clicked the button and got no feedback that a calculation had happened or what it produced. For an embeddable component that a security vendor ships onto compliance-focused sites, that's a real accessibility gap.

I checked the other open PRs/issues first: they cover DOM/SSR import safety, calculate() input robustness, repo-link 404s, CDN pinning, footer CSS, double-registration, README/type accuracy, and tests. None touch accessibility, so this doesn't overlap.

Change

hailbytes-vuln-calculator.js — annotate the results panel in the template:

<div class="results-panel" id="results-panel"
     role="region" aria-label="Infrastructure sizing results"
     aria-live="polite" aria-atomic="true">
  • aria-live="polite" → assistive tech announces the results as they populate, without interrupting.
  • role="region" + aria-label → gives the panel a navigable landmark.
  • The decorative placeholder emoji (🖥️) is marked aria-hidden="true".

No behavioural or layout change for sighted users; no new dependencies (the component stays zero-dep).

Tests

  • Added a zero-dep regression test in test/smoke.test.mjs asserting the results panel carries role="region", aria-live="polite", and an aria-label (the template markup isn't exported, so it asserts against the module source).
  • Full suite green: 66 tests, 66 pass.
  • Verified end-to-end in headless Chromium: the results region exposes the expected role/label/live attributes, and after clicking Calculate the results still render (6 cards, panel shown) with no console errors.

Impact

  • Accessibility: results are now announced to screen-reader users instead of a silent DOM swap.
  • Blast radius: template markup + one test only. No API, styling, or output changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pgy6ji8qXYGPfR7h1mXWUr


Generated by Claude Code

Clicking "Calculate" replaces the results placeholder with the sizing
cards via innerHTML, but the panel had no live-region semantics, so
screen readers announced nothing — a non-sighted user got no feedback
that a calculation happened.

Mark the results panel with role="region", aria-label, and
aria-live="polite" so assistive tech announces results as they populate,
and hide the decorative placeholder emoji from the accessibility tree.

Add a zero-dep regression test asserting the panel carries these ARIA
attributes. Verified end-to-end in headless Chromium: the region exposes
the expected roles/labels and results still render (6 cards) after click.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pgy6ji8qXYGPfR7h1mXWUr
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.

2 participants