Skip to content

Fix: add keyboard accessibility to popup close icons#5882

Open
DhyaniKavya wants to merge 1 commit intosugarlabs:masterfrom
DhyaniKavya:fix/popup-close-accessibility-clean
Open

Fix: add keyboard accessibility to popup close icons#5882
DhyaniKavya wants to merge 1 commit intosugarlabs:masterfrom
DhyaniKavya:fix/popup-close-accessibility-clean

Conversation

@DhyaniKavya
Copy link
Contributor

issue: #5878

Problem:-
-Popup close controls (e.g., print preview and error dialogs) are implemented as elements with onclick handlers. These elements are not focusable and cannot be activated via keyboard.
-Close icons are skipped when navigating with the Tab key
-Keyboard users cannot dismiss popup dialogs
-Assistive technologies do not recognize the icons as interactive controls
-This creates an accessibility barrier and does not meet WCAG 2.1 keyboard accessibility guidelines

Solution:-
-This PR adds keyboard accessibility support to the popup close icons while preserving existing behavior.
-adds role="button" for semantic meaning
-adds tabindex="0" to enable keyboard focus
-adds keyboard activation via Enter and Space
-preserves existing click functionality
-does not alter layout, styling, or popup logic

Changes Made:-
-File modified:
->index.html

added role="button" to popup close icons
added tabindex="0" to enable keyboard focus
added onkeydown handler for Enter/Space activation
ESLint: ✅ no lint errors
Tests: ⚠️ pre-existing failures on master (unrelated to this change)

Impact:-
-Enables keyboard users to dismiss popup dialogs
-Improves screen reader accessibility
-Enhances WCAG 2.1 compliance
-No functional regressions
-Minimal and safe change

Notes:-
This change is intentionally minimal and non-breaking. It improves accessibility without modifying popup logic, layout, or styling. The implementation follows standard accessibility best practices while preserving existing behavior.

Happy to refine further if maintainers prefer a different approach

@github-actions
Copy link
Contributor

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Failed Tests:

palette.test.js
logo.test.js
logoconstants.test.js

@DhyaniKavya
Copy link
Contributor Author

@omsuneri please review this PR . Some tests are failing on the upstream master branch. @vyagh has already raised a PR for "test failing" fix , so after fix the tests will be passed as usual . Thankyou

@DhyaniKavya DhyaniKavya force-pushed the fix/popup-close-accessibility-clean branch from 2f25b32 to aff6ffa Compare February 25, 2026 04:59
@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@DhyaniKavya
Copy link
Contributor Author

@omsuneri @walterbender Rebased the branch successfully and all tests are passing now . Please review the changes, if anything needs change, i am open to address it. Thankyou

Copy link
Contributor

@zealot-zew zealot-zew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen.Recording.2026-03-01.at.2.12.37.PM.mov

i can highlight the message dialog using Enter but cannot close it?

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