Skip to content

Focus Trap in TocAction + docked sheet #70

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
JayPanoz opened this issue Mar 31, 2025 · 0 comments
Open

Focus Trap in TocAction + docked sheet #70

JayPanoz opened this issue Mar 31, 2025 · 0 comments
Assignees

Comments

@JayPanoz
Copy link
Contributor

This is a non-trivial bug I could reduce to the following observations:

  • happens when switching from one transient type of sheet to a docked sheet;
  • React Aria FocusScope is set to contain: false in the docked sheet (the only one with this value for the prop), in order to not block tabbing;
  • Immediately after switching, FocusScope is broken and will focus an element it marked itself with an attribute specifically to be ignored ( data-react-aria-prevent-focus="true" on expand button in ToC);
  • works fine if contain: true – this is why the bug does not happen with the bottom sheet for instance;
  • Close and reopen the docked sheet and it’s working as expected again, so something seems to throw it off while unmounting a different sheet and mounting the docked sheet – action state isOpen stays true;
  • maybe it’s a combination of contain: false and missing the reference for restoreFocus, or maybe it’s something else entirely since it’s fine the other way, or maybe it’s the expand button itself that creates this issue when it becomes focused, I can’t really tell;
  • even disabling the button won’t actually help.

Not sure how to handle that edge case at the moment.

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