[text field] Outlined input label is one pixel off #44341
Labels
component: text field
This is the name of the generic UI component, not the React module!
design
This is about UI or UX design, please involve a designer
enhancement
This is not a bug, nor a new feature
package: material-ui
Specific to @mui/material
Steps to reproduce
Here are 4 focused inputs:
This input's styles have
by default.
Just comparing input 1 and input 2, to my eye, the "margin" where there is no border looks more even in the version 2 than in the version 1. But, we can check that if we see where the "margin" comes from
Input 1, but with
fieldset
set tovisibility: visible
and label inside toopacity: 1
, the white text is the aria label that also serves, thanks to it's padding, to create this "magin" in the border.Input 2, but with fieldset visible.
It is quite clear in inputs 3 and 4 that the label is misaligned to the
fieldset
. The version in 4th is still not quite 100% there, but it's much less than a pixel off, so I'm not sure what can be done about it.In order to fix the mismatch either the fieldset invisible version must be moved, or the visible version must be moved.
If the transtion is to be changed, here it is:
(but don't forget about the non-focused versions)
material-ui/packages/mui-material/src/InputLabel/InputLabel.js
Line 169 in 412dcbf
Another option is to change the NotchedOutline here:
material-ui/packages/mui-material/src/OutlinedInput/NotchedOutline.js
Line 16 in 412dcbf
from
padding: 0 8px
topadding: 0 7px
, because 1px of horizontal size is provided by the border anyway. I think this is actually the most correct change.Search keywords: Outlined input label misaligned
The text was updated successfully, but these errors were encountered: