Skip to content

fix: improve notification center keyboard accessibility#648

Open
ifygreg01-best wants to merge 1 commit into
DogStark:mainfrom
ifygreg01-best:fix/598-notification-center-focus-management
Open

fix: improve notification center keyboard accessibility#648
ifygreg01-best wants to merge 1 commit into
DogStark:mainfrom
ifygreg01-best:fix/598-notification-center-focus-management

Conversation

@ifygreg01-best

Copy link
Copy Markdown

Summary

Adds proper focus management to the notification drawer to meet WCAG 2.1 AA keyboard accessibility requirements.

Changes

  • NotificationContext: Expose a shared bellRef so NotificationBell and NotificationCenter can coordinate focus without prop drilling.
  • NotificationBell: Attach bellRef to the trigger button element.
  • NotificationCenter: Use wasOpenRef to 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:

  • Opening panel moves focus into panel
  • Closing panel restores focus to bell button
  • Escape key closes panel
  • Escape key restores focus to bell
  • No spurious focus call on initial render
  • No errors on repeated open/close cycles
  • Bell attaches bellRef correctly
  • Bell calls toggleCenter on click

Verification

  • npm run lint — no new errors (pre-existing <a> link warning in footer unchanged)
  • npm run build — passes
  • npm test — all tests pass

Closes #598

- 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
@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

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.

[Frontend] Add Focus Management to NotificationCenter

2 participants