Skip to content

[Feature request]: options to prevent focus on body when restore #411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
YuanboXue-Amber opened this issue Aug 29, 2024 · 0 comments
Open

Comments

@YuanboXue-Amber
Copy link
Contributor

Problem description:

Open this example: https://stackblitz.com/edit/vitejs-vite-ytxz4e?file=package.json,src%2FApp.tsx&terminal=dev

  1. Turn on NVDA
  2. Focus on the 'Trigger' button, press enter key, the 'close' button should be visible and focused
  3. Switch NVDA to forms mode, press enter key again, notice the screen reader announces 'document':
image

This happens because the restore focus is async with a timeout. When switching the example to the react useEffect restore focus, this problem does not appear (and if setTimeout is used in react useEffect, it appears as well).

Possible solutions:

Option 1: provide the ability to synchronously focus on trigger - this was discussed in teams meeting and discarded because the trigger might not be focusable
Option 2: provide the ability to focus on dummy input with aria-hidden when focus moves back to trigger.

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

No branches or pull requests

1 participant