fix: add escape-to-dismiss and focus pause to toast notifications#383
Open
edrizxabdulganiyu-blip wants to merge 2 commits into
Open
fix: add escape-to-dismiss and focus pause to toast notifications#383edrizxabdulganiyu-blip wants to merge 2 commits into
edrizxabdulganiyu-blip wants to merge 2 commits into
Conversation
- Add tabIndex=0 to toast cards so they are Tab-reachable - Pause auto-dismiss on focus (mirrors mouseenter), resume on blur (mirrors mouseleave) — keyboard users can read a toast without it vanishing - Dismiss the focused toast on Escape key press - Restore focus to the pre-toast element after any dismissal (Escape or Close button) to prevent focus loss to <body> - Add containerRef to detect focus entering/leaving the toast region so intra-toast focus movement (card ↔ Close button) does not restart timer Tests (components/ToastProvider.keyboard.test.tsx, 14 tests): - tabIndex=0 presence - focus pauses timer, blur resumes timer - intra-toast focus movement keeps timer paused - Escape dismisses focused card or Close button - focus return after Escape and after Close click - no jest-axe violations when focused - Escape only dismisses the focused toast - non-Escape keys do not dismiss - hover and focus pauses coexist correctly - userEvent Tab traversal reaches the card Docs: add Toast notification keyboard behaviour table to README.md
|
@edrizxabdulganiyu-blip 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! 🚀 |
Author
|
can you please drop point |
omolobamoyinoluwa-max
pushed a commit
to omolobamoyinoluwa-max/Liquifact-frontend
that referenced
this pull request
Jul 13, 2026
…ultisig-weight-threshold-263-gas-optimized-health feat: Liquifact#264 multisig weight threshold + Liquifact#263 gas-optimized health slots
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.
fix: keyboard accessibility for toast notifications
Summary
Toast notifications were only dismissible by clicking "Close" or waiting for the timer. A
keyboard user focusing a toast had no way to dismiss it, and the timer was not paused on focus
— so the toast could vanish while being read. This PR brings full keyboard parity with the
existing mouse behaviour.
Changes
components/ToastProvider.jsx
navigate to the Close button first.
previously-focused element so focus can be restored after dismissal.
leaves the entire toast region; moving focus between the card and its Close button keeps the
timer paused.
dismisses that toast only.
element that was active before the user tabbed into the toast, preventing focus loss to .
components/ToastProvider.keyboard.test.tsx (new — 14 tests)
┌─────┬──────────┐
│ # │ Scenario │
├─────┼────────────────────────────┤
│ 1 │ tabIndex=0 present on card │
├─────┼─────────────────────────────────┤
│ 2 │ Focus pauses auto-dismiss timer │
├─────┼──────────────────────────────────────┤
│ 3 │ Blur outside container resumes timer │
├─────┼─────────────────────────────────────────────────────┤
│ 4 │ Focus moving card ↔ Close button keeps timer paused │
├─────┼─────────────────────────────────────────────────────┤
│ 5 │ Escape on card dismisses it │
├─────┼─────────────────────────────────────────────────────┤
│ 6 │ Escape on Close button dismisses it │
├─────┼─────────────────────────────────────────────────────┤
│ 7 │ Focus returns to pre-toast element after Escape │
├─────┼──────────────────────────────────────────────────────┤
│ 8 │ Focus returns to pre-toast element after Close click │
├─────┼──────────────────────────────────────────────────────┤
│ 9 │ No jest-axe violations when toast is focused │
├─────┼──────────────────────────────────────────────────────┤
│ 10 │ Escape only dismisses the focused toast, not all │
├─────┼──────────────────────────────────────────────────────┤
│ 11 │ Non-Escape keys (Enter, Space, Tab) do not dismiss │
├─────┼──────────────────────────────────────────────────────┤
│ 12 │ Escape-dismiss cancels the stale timer │
├─────┼──────────────────────────────────────────────────────┤
│ 13 │ Hover pause and focus pause coexist correctly │
├─────┼──────────────────────────────────────────────────────┤
│ 14 │ Card is reachable via userEvent Tab traversal │
└─────┴──────────────────────────────────────────────────────┘
README.md
Added a Toast notification keyboard behaviour table under the Accessibility section.
What was tested
are unrelated to this PR.
Accessibility contract
focus-visible:ring-cyan-400).
close Give the toast close button reliable Escape-to-dismiss and focus handling #151