Improve keyboard accessibility of toast notifications
Description
Toasts in components/ToastProvider.jsx can only be dismissed by clicking "Close" or waiting for the timer; there is no keyboard shortcut to dismiss, and hovering pauses the timer but focusing (keyboard equivalent of hover) does not — so a keyboard user reading a toast can have it disappear mid-read. This issue adds keyboard parity: pause on focus, dismiss on Escape, and sensible focus return.
Requirements and context
- Repository scope: Liquifact/Liquifact-frontend only.
- Pause/resume the auto-dismiss timer on
focus/blur of the toast (mirroring the existing mouseenter/mouseleave pause/resume) so focusing a toast does not let it vanish.
- Allow
Escape to dismiss the focused toast.
- Ensure the "Close" button and toast are reachable in a sensible tab order and that focus moves to a safe element after dismissal (no focus loss to
body).
- Keep the
role="status"/aria-live="polite" region and all existing variant styling.
Suggested execution
- Fork the repo and create a branch
git checkout -b a11y/toast-22-keyboard-dismiss
- Implement changes
- Write code in: update
components/ToastProvider.jsx.
- Write comprehensive tests in: create
components/ToastProvider.keyboard.test.tsx using user-event and fake timers — assert focus pauses the timer, Escape dismisses, and focus return.
- Add documentation: note the keyboard behaviour in
README.md.
- Add comments on the focus/blur pause parity.
- Validate a11y: no
jest-axe violations and keyboard-operable dismissal.
- Test and commit
Test and commit
- Run
npm run lint, npm test, and npm run build.
- Cover edge cases: focus-pause, Escape dismiss, and focus return after close.
- Include the full
npm test output.
Example commit message
fix: add escape-to-dismiss and focus pause to toast notifications
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the Liquifact community on Discord for questions, reviews, and faster merges: https://discord.gg/JrGPH4V3
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Improve keyboard accessibility of toast notifications
Description
Toasts in
components/ToastProvider.jsxcan only be dismissed by clicking "Close" or waiting for the timer; there is no keyboard shortcut to dismiss, and hovering pauses the timer but focusing (keyboard equivalent of hover) does not — so a keyboard user reading a toast can have it disappear mid-read. This issue adds keyboard parity: pause on focus, dismiss on Escape, and sensible focus return.Requirements and context
focus/blurof the toast (mirroring the existingmouseenter/mouseleavepause/resume) so focusing a toast does not let it vanish.Escapeto dismiss the focused toast.body).role="status"/aria-live="polite"region and all existing variant styling.Suggested execution
git checkout -b a11y/toast-22-keyboard-dismisscomponents/ToastProvider.jsx.components/ToastProvider.keyboard.test.tsxusinguser-eventand fake timers — assert focus pauses the timer, Escape dismisses, and focus return.README.md.jest-axeviolations and keyboard-operable dismissal.Test and commit
npm run lint,npm test, andnpm run build.npm testoutput.Example commit message
fix: add escape-to-dismiss and focus pause to toast notificationsGuidelines
Community & contribution rewards