Skip to content

web(a11y): preserve keyboard focus after toast dismissal - #567

Open
umpireboulianne-design wants to merge 1 commit into
Sub-Rosa-Issue:mainfrom
umpireboulianne-design:fix/issue-545
Open

umpireboulianne-design wants to merge 1 commit into
Sub-Rosa-Issue:mainfrom
umpireboulianne-design:fix/issue-545

Conversation

@umpireboulianne-design

Copy link
Copy Markdown
Contributor

Summary

  • Update ToastProvider in apps/web/src/ui/Toast.tsx to record the active trigger element when push() is called (including preserving the original opener across working → success/error async transitions).
  • Restore keyboard focus to the recorded opener when a toast is dismissed via its close button, via the Escape key (onKeyDown), or when focus was inside the dismissed toast.
  • Add automated tests in apps/web/src/ui/Toast.test.tsx (imported by countdown.test.ts so pnpm web:test executes them in CI) covering close-button dismissal, Escape key dismissal, and async working → completion sequences.
  • Document toast focus-restoration behavior in docs/DEMO_SCRIPT.md.

Supply-chain review

  • No package scripts or dependencies changed. If changed, explain why below.
  • No .vscode/, workflow, or other editor/config file changes. If changed, list them below.
  • No lockfile changes. If changed, explain the update below.
  • No binary or font asset changes. If changed, list and justify them below.
  • I confirm no automatic task (such as preinstall/postinstall) was added.
  • I confirm no hidden executable payload (encoded blob, obfuscated command, or unexpected binary) was added.
  • Any changed executable or binary was reviewed by a maintainer.

Testing

  • node --import tsx --test src/ui/Toast.test.tsx in apps/web (3/3 tests pass)
  • node --import tsx --test src/lib/countdown.test.ts in apps/web (9/9 tests pass)
  • node scripts/check-links.js (passes)

Closes #545
Fixes #545

@karagozemin

Copy link
Copy Markdown
Collaborator

I reviewed the diff and did not find a malicious payload, but this branch now conflicts with current main after related changes landed. Please rebase on current main, preserve the already-merged security and CI gates, rerun the relevant tests, and update this PR; it is not safe to merge the stale conflict state.

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.

web(high/easy): preserve keyboard focus after toast dismissal

2 participants