fix: improve notification center keyboard accessibility#648
Open
ifygreg01-best wants to merge 1 commit into
Open
fix: improve notification center keyboard accessibility#648ifygreg01-best wants to merge 1 commit into
ifygreg01-best wants to merge 1 commit into
Conversation
- Add bellRef to NotificationContext so bell button ref is shared - Attach bellRef to the button in NotificationBell - Focus panel on open; restore focus to bell on close (all close paths) - Escape key closes panel and returns focus to bell button - Add wasOpenRef guard to avoid spurious focus on initial render - Fix jest.config.js transform to handle jest.setup.js ESM syntax - Fix prettier version constraint (^3.9.0 → ^3.8.4, no stable 3.9 exists) - Add 8 tests covering open/close focus, Escape, bellRef attachment
|
@ifygreg01-best Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Adds proper focus management to the notification drawer to meet WCAG 2.1 AA keyboard accessibility requirements.
Changes
bellRefsoNotificationBellandNotificationCentercan coordinate focus without prop drilling.bellRefto the trigger button element.wasOpenRefto track open→close transitions and restore focus to the bell button on every close path (close button click, Escape key, backdrop click).Testing
Added 8 tests in
src/components/Notifications/__tests__/NotificationCenter.test.tsx:bellRefcorrectlytoggleCenteron clickVerification
npm run lint— no new errors (pre-existing<a>link warning in footer unchanged)npm run build— passesnpm test— all tests passCloses #598