-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Modal] Tab key press causes scroll change #13702
Comments
I could reproduce the same issue on Bootstrap. Maybe related to twbs/bootstrap#21661. |
I recently looked into that and recognized that react-bootstrap had the same issue too. The official authoring practices trap it by putting up a I think we can fix this in one PR that implements dialogs according to the authoring practices (proper roles + focus trap). |
@eps1lon I like how the official authoring practices and the antd version uses two sentinels DOM nodes to solve the problem. Gestalt has an interesting focus logic too. |
@oliviertassinari Looks like that recent PR is not enough to fix the issue for all cases. If you
scroll position will be changed in the result. For Material UI it is not reproduced because in the most cases we have a fixed AppBar in the page beginning with some focusable elements in it. And browser does not scroll this elements into the viewport on focus. I could suggest to place also two sentinel fixed hidden buttons (or two divs with |
Are the authoring practices doing this as well? We essentially copied their strategy and place the sentinels around the dialog body not the document body. Have you tried this on https://next.material-ui.com? |
No, the problem is not with
Try to remove all fixed elements (header and two navs elements) through the Developer tools, close developer tools and change focus from browser address bar: |
Please open a new issue and fill out the template. Especially something without removing elements with the devtools. If you break the page I would expect behavior to break as well. |
Expected Behavior 🤔
Change focused element through [Shift +] Tab should not change scroll position when some
Modal
is open by default.Current Behavior 😯
Focusing through keyboard on whole page is active when there is any link on page.
Steps to Reproduce 🕹
On the Dialog Demo open
Simple Dialog
and press Shift + Tab. Page is scrolled to end.On https://codesandbox.io/s/0y8n3r593v scroll to green button and press it. Press Tab three times or click to browser's url and then press Tab. Page is scrolled to start.
Context 🔦
Looks like
<a>
elements cause the problem.Your Environment 🌎
The text was updated successfully, but these errors were encountered: