[dialog][drawer][focus trap] Fix initial focus target#48280
Merged
mj12albert merged 4 commits intomui:masterfrom Apr 18, 2026
Merged
[dialog][drawer][focus trap] Fix initial focus target#48280mj12albert merged 4 commits intomui:masterfrom
mj12albert merged 4 commits intomui:masterfrom
Conversation
Netlify deploy previewhttps://deploy-preview-48280--material-ui.netlify.app/ Bundle size report
|
725a4a7 to
1d2988b
Compare
Bundle size
Deploy previewhttps://deploy-preview-48280--material-ui.netlify.app/ Check out the code infra dashboard for more information about this PR. |
1d2988b to
4adc553
Compare
4adc553 to
cbe75d2
Compare
Member
ZeeshanTamboli
left a comment
There was a problem hiding this comment.
It works but does this solution feel like a workaround?
Member
Author
It's how Floating UI does it 😅 |
cbe75d2 to
5e5de13
Compare
Member
Author
|
Doesn't fix directly but should help |
ZeeshanTamboli
approved these changes
Apr 17, 2026
Member
Can you check? |
|
Cherry-pick PRs will be created targeting branches: v7.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #37672 that avoids breaking changes
A private data attribute is used to mark the correct focus target
Testing steps:
DialogwithfullScreen,scroll="body", noautoFocusing elements in the content, and very long content (helps observe keyboard scrolling)Expected: it scrolls, focus ring can be seen around the dialog popup (Stackblitz)
Before the fix: doesn't scroll because the wrong thing is focused (Stackblitz)
Fixes #42989