Skip to content

fix: Input shrinks to its wrapper past the browser default of size=20#35764

Open
smhigley wants to merge 2 commits intomicrosoft:masterfrom
smhigley:input-size
Open

fix: Input shrinks to its wrapper past the browser default of size=20#35764
smhigley wants to merge 2 commits intomicrosoft:masterfrom
smhigley:input-size

Conversation

@smhigley
Copy link
Contributor

@smhigley smhigley commented Feb 19, 2026

Previous Behavior

This is a little complex since it deals with <input>-specific browser styling around min-width. Input elements have a default size="20" (the html attribute, not our Fluent one), which creates something like a min-width style, but not actually a default min-width, so it is not overridden by our CSS style of min-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:

  1. smaller than ~150px ish
  2. do not absolutely force their children to shrink

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 px

Here'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 added size="1" to the inner <input>, so it together with the existing min-width style should allow this for any container.

Related Issue(s)

@smhigley smhigley requested review from a team and dmytrokirpa as code owners February 19, 2026 21:41
@github-actions
Copy link

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.291 MB
322.941 kB
1.291 MB
322.944 kB
7 B
3 B
react-datepicker-compat
DatePicker Compat
225.014 kB
63.584 kB
225.021 kB
63.588 kB
7 B
4 B
react-input
Input
26.246 kB
8.688 kB
26.253 kB
8.692 kB
7 B
4 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.306 kB
68.52 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.15 kB
35.693 kB
🤖 This report was generated against 15159bafa8fed4f264c0df9f49879e8e28f4cbb3

@github-actions
Copy link

Pull request demo site: URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants