fix: Input shrinks to its wrapper past the browser default of size=20#35764
Open
smhigley wants to merge 2 commits intomicrosoft:masterfrom
Open
fix: Input shrinks to its wrapper past the browser default of size=20#35764smhigley wants to merge 2 commits intomicrosoft:masterfrom
smhigley wants to merge 2 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -51,3 +51,12 @@ export const WithAppearanceOverride = () => ( | |||
| </FluentProvider> | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Charts-DonutChart 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png | 5570 | Changed |
| vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png | 5581 | Changed |
vr-tests-react-components/DatePicker Compat 11 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/DatePicker Compat.default - Dark Mode.opened.chromium.png | 3662 | Changed |
| vr-tests-react-components/DatePicker Compat.default - Dark Mode.rest.chromium.png | 4996 | Changed |
| vr-tests-react-components/DatePicker Compat.default - High Contrast.opened.chromium.png | 2710 | Changed |
| vr-tests-react-components/DatePicker Compat.default - High Contrast.rest.chromium.png | 4253 | Changed |
| vr-tests-react-components/DatePicker Compat.default.opened.chromium.png | 9944 | Changed |
| vr-tests-react-components/DatePicker Compat.default.rest.chromium.png | 9964 | Changed |
| vr-tests-react-components/DatePicker Compat.Underlined.default.chromium.png | 409 | Changed |
| vr-tests-react-components/DatePicker Compat.when rendering inline, it should not render behind relatively positioned elements.default.chromium.png | 440 | Changed |
| vr-tests-react-components/DatePicker Compat.showWeekNumbers - Dark Mode.default.chromium.png | 474 | Changed |
| vr-tests-react-components/DatePicker Compat.showWeekNumbers - High Contrast.default.chromium.png | 787 | Changed |
| vr-tests-react-components/DatePicker Compat.showWeekNumbers.default.chromium.png | 440 | Changed |
vr-tests-react-components/Input Converged 24 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Input Converged.Appearance- filled-darker.hover.chromium.png | 135 | Changed |
| vr-tests-react-components/Input Converged.Appearance- filled-lighter.default.chromium.png | 121 | Changed |
| vr-tests-react-components/Input Converged.Appearance- outline (default).hover.chromium.png | 267 | Changed |
| vr-tests-react-components/Input Converged.Disabled, appearance- filled-lighter.hover.chromium.png | 67 | Changed |
| vr-tests-react-components/Input Converged.Disabled, appearance- outline.hover.chromium.png | 87 | Changed |
| vr-tests-react-components/Input Converged.Disabled, appearance- underline.focused.chromium.png | 64 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- filled-lighter.focused.chromium.png | 291 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- filled-darker.hover.chromium.png | 339 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- filled-darker.focused.chromium.png | 316 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- outline.focused.chromium.png | 370 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- underline.focused.chromium.png | 313 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- filled-lighter.hover.chromium.png | 314 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- outline.hover.chromium.png | 337 | Changed |
| vr-tests-react-components/Input Converged.Size- large.default.chromium.png | 309 | Changed |
| vr-tests-react-components/Input Converged.Invalid, appearance- underline.hover.chromium.png | 217 | Changed |
| vr-tests-react-components/Input Converged.Size- small.default.chromium.png | 202 | Changed |
| vr-tests-react-components/Input Converged.With value.hover.chromium.png | 208 | Changed |
| vr-tests-react-components/Input Converged.contentAfter.default.chromium.png | 275 | Changed |
| vr-tests-react-components/Input Converged.With value.default.chromium.png | 195 | Changed |
| vr-tests-react-components/Input Converged.With value.focused.chromium.png | 310 | Changed |
| vr-tests-react-components/Input Converged.contentAfter - RTL.default.chromium.png | 281 | Changed |
| vr-tests-react-components/Input Converged.contentBefore - RTL.default.chromium.png | 255 | Changed |
| vr-tests-react-components/Input Converged.contentBefore.default.chromium.png | 254 | Changed |
| vr-tests-react-components/Input Converged.Shrink to wrapper.default.chromium.png | 0 | Added |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 745 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 609 | Changed |
vr-tests-react-components/SearchBox Converged 24 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/SearchBox Converged.Appearance- filled-darker.default.chromium.png | 7044 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- filled-lighter.default.chromium.png | 9918 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- filled-darker.hover.chromium.png | 7019 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- filled-lighter.hover.chromium.png | 9915 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- underline.default.chromium.png | 7122 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- outline (default).hover.chromium.png | 7138 | Changed |
| vr-tests-react-components/SearchBox Converged.Clears value.dismiss clicked.chromium.png | 7065 | Changed |
| vr-tests-react-components/SearchBox Converged.Appearance- underline.hover.chromium.png | 7165 | Changed |
| vr-tests-react-components/SearchBox Converged.Clears value.input focused.chromium.png | 7197 | Changed |
| vr-tests-react-components/SearchBox Converged.Clears value.dismiss focused.chromium.png | 7111 | Changed |
| vr-tests-react-components/SearchBox Converged.Disabled, appearance- filled-lighter.hover.chromium.png | 9778 | Changed |
| vr-tests-react-components/SearchBox Converged.Disabled, appearance- outline.focused.chromium.png | 7218 | Changed |
| vr-tests-react-components/SearchBox Converged.Size- large.default.chromium.png | 9382 | Changed |
| vr-tests-react-components/SearchBox Converged.Disabled, appearance- underline.hover.chromium.png | 7232 | Changed |
| vr-tests-react-components/SearchBox Converged.Size- small.default.chromium.png | 5144 | Changed |
| vr-tests-react-components/SearchBox Converged.Size- small.hover.chromium.png | 5152 | Changed |
| vr-tests-react-components/SearchBox Converged.Size- large.hover.chromium.png | 9430 | Changed |
| vr-tests-react-components/SearchBox Converged.With custom dismiss - RTL.default.chromium.png | 7024 | Changed |
| vr-tests-react-components/SearchBox Converged.WIth contentAfter.hover.chromium.png | 7168 | Changed |
| vr-tests-react-components/SearchBox Converged.With custom dismiss.default.chromium.png | 7106 | Changed |
| vr-tests-react-components/SearchBox Converged.With custom dismiss - RTL.focused.chromium.png | 6930 | Changed |
| vr-tests-react-components/SearchBox Converged.With value.default.chromium.png | 7198 | Changed |
| vr-tests-react-components/SearchBox Converged.With custom dismiss.hover.chromium.png | 7133 | Changed |
| vr-tests-react-components/SearchBox Converged.With value.hover.chromium.png | 7129 | Changed |
vr-tests-react-components/Shadow DOM 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Shadow DOM.Default.default.chromium.png | 306 | Changed |
vr-tests-react-components/TagPicker 3 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png | 1319 | Changed |
| vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png | 658 | Changed |
| vr-tests-react-components/TagPicker.disabled - RTL.disabled input hover.chromium.png | 635 | Changed |
There were 63 duplicate changes discarded. Check the build logs for more information.
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.

Previous Behavior
This is a little complex since it deals with
<input>-specific browser styling around min-width. Input elements have a defaultsize="20"(the html attribute, not our Fluent one), which creates something like amin-widthstyle, but not actually a defaultmin-width, so it is not overridden by our CSS style ofmin-width: 0. The default behavior is to ensure at least 20 characters are shown, which is something like a minimum width of 150px (which can vary a little per OS, etc.).This creates a problem where the Fluent Input does not shrink to containers that are both:
One example is containers with
display: grid, which is incidentally the style our Field control uses. So the Input does not shrink with a Field when the Field goes below ~150ish pxHere's a stackblitz from a partner team showing the issue (either zoom, shrink the window, or both to see input grow past the container bounds): https://stackblitz.com/edit/yt5wtcjy?file=index.html
(there is also an ADO a11y issue related to reflow)
New Behavior
From both my memory and the CSS style of
min-width: 0, I believe our intention was to make our Fluent Input shrink to any container, no matter how small. I've addedsize="1"to the inner<input>, so it together with the existingmin-widthstyle should allow this for any container.Related Issue(s)