[TextField] Fix Safari outlined notch expansion in flex layouts#48566
Open
maxmorlocke wants to merge 3 commits into
Open
[TextField] Fix Safari outlined notch expansion in flex layouts#48566maxmorlocke wants to merge 3 commits into
maxmorlocke wants to merge 3 commits into
Conversation
Deploy previewhttps://deploy-preview-48566--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
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.
This fixes a Safari/WebKit rendering bug where the outlined TextField notch fails to expand correctly in flex layouts (commonly reproduced with Stack), causing the floating label to overlap the top border.
The root cause is WebKit’s handling of percentage max-width on legend inside fieldset in this layout scenario. To my knowledge, this:
I updated OutlinedInput notch expansion style to avoid percentage max-width in the notched state ('100%' maxWidth: '100%' → 'none'). Using this approach keeps behavior consistent across browsers while specifically addressing Safari/WebKit and does not rely on any hardcoded values for width and should not change behavior.
I added a test that reproduces this flex layout scenario and asserts the notch expands on focus. I also added an e2e test on this scenario. These tests (and any tests that failed due to this change) now test on behavior, not on a strictly computed style. I find this makes for more robust tests, but I am happy to change if this is problematic.