-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[TrapFocus] Fixed focus theft #2681
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
Conversation
</FrameContext.Provider> | ||
<FocusManagerContext.Provider | ||
value={mergedFocusManager} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just use FocusManager
and not allow any overrides?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now we probably should. Not sure we'll ever need to override it. We can do it when we do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a different pattern than we've previously been using, however FocusManager
has some overhead we would need to replicate in mocks and it's easier to use the component. Since this is a public API let's go with using FocusManager since adding to an API is easier than removing.
09a9fd6
to
b530356
Compare
Let me know what you think @dleroux I changed it up slightly from what we looked at this morning. Listing and delisting logic now lives inside the hook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a comment on merging but code looks good. It looks like it does fix the issue in web 🎩
Codecov messed up and included files that weren't touched. Coverage is over 90 so I'm going to 🚢 |
WHY are these changes introduced?
Fixes #2641
WHAT is this pull request doing?
Screenie
How to 🎩
Use the performance tab and make sure focus first focusable node is not running rampant. Sample code with two trap focuses below
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes