a11y: make the results panel an ARIA live region#41
Open
dmchaledev wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:aria-live="polite"→ assistive tech announces the results as they populate, without interrupting.role="region"+aria-label→ gives the panel a navigable landmark.🖥️) is markedaria-hidden="true".No behavioural or layout change for sighted users; no new dependencies (the component stays zero-dep).
Tests
test/smoke.test.mjsasserting the results panel carriesrole="region",aria-live="polite", and anaria-label(the template markup isn't exported, so it asserts against the module source).Impact
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pgy6ji8qXYGPfR7h1mXWUr
Generated by Claude Code