Closed yakunins closed 1 year ago
This is more about feature rather a bug because frankly speaking being able to leave to the browser interface is often correct behavior.
The expected solution for this is to wrap portalled content with InFocusGuard
, that should provide the original behavior. But it's not working. Even if I have a test for it 🙄
Leave this to me...
Greetings, Anton! Thank you for this tool :)
The main problem here is that usually createPortal
mounts sharded node as last child of body.
In my case this is a dropdown of a Select, and the Select is inside a focus-trap.
And even a dropdown is within trap's shard, it won't work... :(
leave to the browser interface is often correct behavior
Here is what happening:
BTW same behavior happens with having shard as first focusable child of the body, revealing itself on Shift+Tab.
to wrap portalled content with
InFocusGuard
, but it's not working
Yes. I tried FocusGuard too. They are not working, but might be improved to bugfix in this way:
Underlined attributes is obligatory to make it work.
Check this out: https://8247h3.csb.app/ https://codesandbox.io/s/react-focus-lock-forked-8247h3
So there is a special component with roving tab index over focus guards, which makes them safe and easy to put where needed - https://github.com/theKashey/react-focus-lock/blob/master/src/FocusGuard.js#L18
They are not activating on time 🤷♂️
This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.
Steps to reproduce the issue:
Comments: