feat(ui): improve keyboard accessibility for widgets and toolbar#5810
Closed
DhyaniKavya wants to merge 1 commit intosugarlabs:masterfrom
Closed
feat(ui): improve keyboard accessibility for widgets and toolbar#5810DhyaniKavya wants to merge 1 commit intosugarlabs:masterfrom
DhyaniKavya wants to merge 1 commit intosugarlabs:masterfrom
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
Author
|
@walterbender @omsuneri Please review these changes if they are useful and if any changes are required i am open to address them . Thankyou |
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.
issue: #5809
Problem:-
Several interactive UI elements in Music Blocks are not accessible via keyboard navigation.
-Toolbar icons use elements without href, making them non-focusable and unreachable using the Tab key
-Widget buttons are created using
-These elements lack role="button" and tabindex="0"
-Keyboard users cannot activate controls using Enter or Space
-Screen readers cannot correctly identify these elements as interactive controls
-This results in violation of WCAG 2.1 (2.1.1 Keyboard, 4.1.2 Name, Role, Value)
While the UI functions correctly with a mouse, it is not accessible to keyboard-only users or assistive technologies.
Solution:-
This PR improves keyboard accessibility while preserving all existing functionality:
-adds role="button" to non-semantic interactive elements
-adds tabindex="0" to enable keyboard focus
-adds keydown handlers to trigger click events on Enter and Space
-does not alter existing click behavior
-does not modify layout or styling
Changes Made:-
-File modified:
-> js/widgets/widgetWindows.js
-> add role="button" to dynamically created widget buttons
-> add tabindex="0" to widget buttons
-> add keydown handler for Enter/Space activation
-File modified:
-> index.html
-> add role="button" to toolbar anchor elements
-> add tabindex="0" to toolbar icons
Testing Performed:-
-Manual Verification
-Toolbar icons reachable via Tab
-Widget buttons focusable using keyboard
-Enter activates controls
-Space activates controls
-Focus order remains logical
-No console errors observed
-Automated Testing
Jest: ✅ all tests passed⚠️ pre-existing repository configuration warning (no new lint errors introduced)
Prettier: ✅ formatting verified
ESLint:
Impact:-
-Improves keyboard accessibility across the application
-Enables inclusive access for keyboard-only users
-Improves screen reader compatibility
-Enhances WCAG 2.1 compliance
-No breaking changes
Notes:-
This change is intentionally minimal and non-breaking. It enhances accessibility without modifying core logic, UI behavior, or styling. The implementation follows standard accessibility best practices and preserves all existing interactions.
Happy to adjust if maintainers prefer a different approach.