-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
Open
Description
Prerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
Describe the issue
When creating and opening a modal via JavaScript, I am experiencing an oddity with keyboard navigation:
- Open the modal (in my case it includes a close button in the heading)
- Observe that using Tab to navigate places focus on the close button
- Use Shift-Tab to navigate backwards. The focus visibly stays on the close button as it's the first and only focusable element inside the modal, but the underlying page scrolls down to the bottom (probably because that's where the modal lies in the overall DOM)
Expected behavior:
- Using Shift-Tab does not cause body scrolling
Based on investigation it appears that focus temporarily moves to something in the main page before the focus trap resets it to the modal's close button. Will post more detail here if I find it.
Reduced test cases
See issue description
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Microsoft Edge, Chrome
What version of Bootstrap are you using?
5.3.8