twbs / bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

Home Page:https://getbootstrap.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completing a tab cycle inside a bootstrap modal will cause the page to scroll

aashish-aenow opened this issue · comments

Prerequisites

Describe the issue

When you tab through an open modal, one complete cycle so that the focus goes from the last element on the modal back to the X [close] button, it causes the page to scroll where ever the modal is in the DOM order. This behavior is present in the current bootstrap site as well.

Steps to Reproduce

  1. Add a modal on your page
  2. Toggle the modal and tab through the modal one full cycle until you focus back on the X [close] button.
  3. Move the modal to a different part of the page DOM and repeat step 1 and 2

Reduced test cases

https://getbootstrap.com/docs/5.3/components/modal/#live-demo
Scroll slightly so the "Launch Modal" button is slightly off screen but still clickable or scroll up so the button is almost at the bottom of the page and toggle the modal and tab through the modal

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome, Firefox, Microsoft Edge

What version of Bootstrap are you using?

v5.3.3