Skip to content

a11y: add ARIA semantics + reduced-motion support to the calculator component#12

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

a11y: add ARIA semantics + reduced-motion support to the calculator component#12
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-mob3T

Conversation

@dmchaledev
Copy link
Copy Markdown
Contributor

Problem

The <hailbytes-vuln-calculator> web component is designed to be embedded across marketing sites, but it currently ships with zero accessibility affordances:

  • When the user clicks Calculate, the VM-sizing/cost/ROI results are injected into the DOM with no announcement — screen-reader users get no feedback that anything happened.
  • Every UI label and card title is prefixed with a decorative emoji that assistive tech reads aloud (e.g. 🔍 → "magnifying glass tilted left", ⚡ on the button → "high voltage").
  • Hover animations (button lift/transform, transitions) ignore prefers-reduced-motion, which can cause discomfort for motion-sensitive users.

Fix

Pure presentation/markup changes inside the component — no calculation logic touched:

Change Why
role="region" + aria-live="polite" + aria-atomic="true" on the results panel Screen readers now announce results when they're calculated
aria-hidden="true" on all decorative emoji (header, the 4 section labels, all 6 card titles, the placeholder icon) AT no longer reads out emoji names
aria-label="Calculate Infrastructure" + type="button" on the Calculate button, with the ⚡ wrapped in an aria-hidden span Clean accessible name; explicit non-submit button type
@media (prefers-reduced-motion: reduce) rule disabling transitions/animations/hover transform Respects the OS-level motion preference

Verification

npm test runs only the smoke suite today, but I ran the full suite locally — all 65 tests pass (the changes are additive markup, so nothing in the calculation engine is affected):

# tests 65
# pass 65
# fail 0

Note (out of scope, spotted while here)

demo.html links to github.com/HailBytes/hailbytes-vulnerability-calculator, but the actual repo (per package.json) is HailBytes/vulnerability-calculator — the hailbytes- prefix appears copy-pasted from the sibling packages, so that footer link is dead. Happy to fold the one-line fix into this PR or open a separate one — let me know.


Generated by Claude Code

https://claude.ai/code/session_01DmSERbkobLE4Hy5phDB7bW

The embeddable calculator had no accessibility affordances. This adds:

- aria-live="polite" region on the results panel so screen readers
  announce VM sizing/cost results when the user clicks Calculate
  (results were previously injected silently).
- aria-hidden="true" on all decorative emoji (header, section labels,
  card titles, placeholder) so assistive tech no longer reads them out
  (e.g. "magnifying glass tilted left").
- A clean aria-label and type="button" on the Calculate button.
- prefers-reduced-motion media query that disables hover transforms,
  transitions, and animations for users who request it.

No calculation logic changes; all 65 tests still pass.
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