Skip to content
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

[Dialog] Inconsistent autofocus depending on the trigger #2871

Open
erkivrff opened this issue Apr 29, 2024 · 0 comments
Open

[Dialog] Inconsistent autofocus depending on the trigger #2871

erkivrff opened this issue Apr 29, 2024 · 0 comments

Comments

@erkivrff
Copy link

erkivrff commented Apr 29, 2024

Bug report

Current Behavior

  • When dialog is triggered from a button, element with autoFocus attribute is focused
  • When dialog is triggered from a dropdown menu, first focusable element is focused
Screen.Recording.2024-04-29.at.17.30.58.mov

Expected behavior

Expecting it to be consistent:

  • When dialog is triggered from a button, element with autoFocus attribute is focused
  • When dialog is triggered from a dropdown menu, element with autoFocus attribute is focused

Reproducible example

https://codesandbox.io/p/devbox/autumn-river-p4nvxw?file=%2Fsrc%2FApp.tsx%3A18%2C31

Suggested solution

There seems to be a feature that tries to focus on first focusable element which seems quite redundant

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-dialog, @radix-ui/dropdown-menu 1.0.5, 2.0.6
React n/a 18.2
Browser Chrome 124
Assistive tech n/a n/a
Node n/a 20.10.0
npm/yarn npm 10.2.3
Operating System Mac OS X 14
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