fix(a11y): add keyboard support to interactive non-button elements#470
Open
akinshaywai wants to merge 1 commit intoalibaba:mainfrom
Open
fix(a11y): add keyboard support to interactive non-button elements#470akinshaywai wants to merge 1 commit intoalibaba:mainfrom
akinshaywai wants to merge 1 commit intoalibaba:mainfrom
Conversation
ReflectionItem in cards.tsx used a plain <span> with onClick but no
keyboard handler, making it inaccessible to keyboard users. Added
role='button', tabIndex={0}, aria-expanded, and onKeyDown (Enter/Space).
The session list item in HistoryList.tsx had role='button' and tabIndex
but was missing an onKeyDown handler, so keyboard users could not
activate it. Added the missing handler.
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.
Problem
Two interactive elements were only accessible via mouse, failing WCAG 2.1 SC 2.1.1 (Keyboard):
1.
ReflectionItemincards.tsxA
<span>used as a toggle to expand/collapse reflection text. It had anonClickhandler but:role="button"— screen readers didn't identify it as interactivetabIndex— keyboard users couldn't focus itonKeyDown— pressing Enter or Space did nothing2. Session list item in
HistoryList.tsxA
<div role="button" tabIndex={0}>was already focusable, but had noonKeyDownhandler, so keyboard users who pressed Enter or Space to activate it got no response.Fix
cards.tsx—ReflectionItem:role="button",tabIndex={0},aria-expanded={expanded}onKeyDownto toggle on Enter / SpaceHistoryList.tsx:onKeyDownto match the existingonClickbehaviourTest Plan