Open vladmoroz opened 2 days ago
@michaldudak this problem is caused by Safari not focusing buttons on mousedown, so the previously focused element isn't the trigger.
When using useClick
from Floating UI, this problem is solved, but custom event handlers won't work.
Possible solutions:
useClick
hookcontext.dataRef.current.openEvent
(that's what the focus manager checks for)I don't think switching to useButton
and rendering a <div>
(which might take focus instead) will be reliable since they compose a native <button>
tag in theory.
Steps to reproduce
Link to live example: https://master--base-ui.netlify.app/components/react-dialog/
Current behavior
Focus is returned to the start of the document, apparently
Expected behavior
Focus is returned to the trigger
Context
No response
Your environment
Safari 17.6
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo
Search keywords: safari, focus, return, trigger, close, dialog, modal