Repository navigation
fix(a11y): expose question card option state via aria-pressed (#9492) - #9507
Conversation
The ask_question card's option buttons carried their selected state only in
CSS classes. A screen reader announced every option as a generic button and
could not report which one was chosen (WCAG 4.1.2 Name/Role/Value).
Each option button now sets aria-pressed={selected} in both modes.
aria-pressed matches multiSelect's independent toggles exactly, and for
single-select it keeps the intended click-again-to-deselect behavior honest:
role=radio semantics forbid unchecking by re-activation, which this control
deliberately supports. The deselect behavior is unchanged.
Tests assert the aria-pressed true/false transitions in both modes,
including the single-select deselect, replacing className-based selection
assertions; one className assertion remains to pin the visual styling.
Closes #9492
|
Intent: Make the ask_question card's option buttons announce their selected state to assistive technology by adding |
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Non-rendering ARIA-only change: option buttons now announce selected state to assistive tech honestly (aria-pressed matches the real click-again-to-deselect behavior); zero pixel or copy delta, so no screenshot owed. [UX-REVIEWED] 745a2b4 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Real WCAG 4.1.2 gap, fixed at the root with the correct ARIA pattern; the radio-semantics alternative is rejected for a stated, verifiable behavioral reason. [DESIGN-REVIEWED] 745a2b4 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All verification complete. The kept className pin exists at First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (4 items)Intent: let a screen-reader user hear which answer option is selected on the ask_question card — a FIX.
[FIRST-PRINCIPLES-REVIEWED] 745a2b4 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
dwu96
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: a11y fix exposing the option card's selected state programmatically via aria-pressed (WCAG 4.1.2) — CSS-only state was the root cause; the only non-test change is one added attribute plus a boolean coercion, no behaviour change.
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: WCAG 4.1.2 fix — option buttons in QuestionCard exposed selected state only via CSS classes, so aria-pressed is now bound to the existing isSelected value (coerced to a real boolean) and the test file switches from className assertions to aria-pressed assertions; no logic, data or trust-boundary change.
chenmingwei23
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: a11y bug fix - expose selected state via aria-pressed (WCAG 4.1.2), replacing CSS-only state; 2 files, component plus its test.
…tdev#9492) (kirodotdev#9507) The ask_question card's option buttons carried their selected state only in CSS classes. A screen reader announced every option as a generic button and could not report which one was chosen (WCAG 4.1.2 Name/Role/Value). Each option button now sets aria-pressed={selected} in both modes. aria-pressed matches multiSelect's independent toggles exactly, and for single-select it keeps the intended click-again-to-deselect behavior honest: role=radio semantics forbid unchecking by re-activation, which this control deliberately supports. The deselect behavior is unchanged. Tests assert the aria-pressed true/false transitions in both modes, including the single-select deselect, replacing className-based selection assertions; one className assertion remains to pin the visual styling. Closes kirodotdev#9492 Co-authored-by: Nick Bowers <nrb@amazon.com>
Problem / Motivation
The ask_question card shows answer options as buttons. When a user picks one, the card only changes the button's colors. A screen reader never hears about it: every option is announced as a plain button, with no way to tell which one is chosen (WCAG 4.1.2 Name/Role/Value). The card's fold toggle already announces its state via
aria-expanded; the option buttons were the gap.Why it matters
A screen-reader user can pick an answer and get no confirmation it is selected. On a multi-question card they cannot review what they are about to submit. The selection state exists only as pixels.
What changed (motivation → approach → change)
The option button was rendered with only
key,onClick, andclassName, so the selected state lived in CSS classes alone.Each option button now sets
aria-pressed={isSelected}. This is the toggle-button pattern, used in both modes. It matches multiSelect exactly: each option is an independent toggle. It also stays honest for single-select, which deliberately supports click-again-to-deselect —role=radio+aria-checkedwould promise a control that cannot be unchecked by re-activating it, and this one can (the issue's own analysis flags this). The same fix class landed in #7495 for the chat pin toggle.The deselect behavior itself is unchanged — the diff touches only the button's attributes and the tests.
Tests
aria-pressedtransitions — all options startfalse, picking one flips it totrue, a second click on it (deselect) returns it tofalse.aria-pressedindependently per option; toggling one off leaves the othertrue.aria-pressed(the programmatic state) instead of CSS class names.Manual verification
N/A — unit coverage sufficient: the change is a single ARIA attribute whose true/false transitions are asserted directly in both modes.
Screenshots / video
Why no screenshot: the diff adds a non-rendering ARIA attribute; no pixel changes in any state.
Related Issues
Closes #9492
Pattern harvest
Rule candidate: review-prompt
Pattern: interactive element whose selected/active state is styled via className with no matching aria-* state attribute
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)