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
Offcanvas: activate focustrap when backdrop is enabled #36717
Offcanvas: activate focustrap when backdrop is enabled #36717
Conversation
7326d52
to
9c966fd
Compare
Added 658045e to tackle the 3rd point from the issue:
To test it in the docs, simply focus the main header (keyboard), open both menus with 'Enter' and then press to 'Escape' to close them. 'Escape' didn't do anything before since offcanvases didn't get the focus. Now it's working. |
If I have well understood the 2nd point in the issue, it is safe to remove |
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.
JS part LGTM! I've added 2 commits to handle 2 other points mentioned in the issue. This PR will need also a review from @patrickhlauke.
Looking good, and correctly addresses the issue #36596 At a higher level though, I'm wondering if we should just always enable focus trapping? Or, if we do want to allow non-modal offcanvases, we should document this clearly in the docs (currently it seems the docs are silent about focus behaviour at all) and also make sure that |
Either way, an offcanvas that doesn't scroll or has a backdrop, behaves like modal, so I think is right for know. |
closes #36596
Preview https://deploy-preview-36717--twbs-bootstrap.netlify.app/
/cc @patrickhlauke