Material-ui: TextField labels centered when focused in beta.45

Created on 8 May 2018  路  3Comments  路  Source: mui-org/material-ui

When Textfields are in a container that has text-align: center, their labels become centered when you focus them as of beta.45. This didn't occur in previous versions.

screen shot 2018-05-08 at 3 36 56 pm

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior


The labels' alignment should stay the same regardless of focus state. Ideally (and previously) they should always be left aligned. If inheriting the parent's text alignment was a purposeful change in beta.45, it should respect it in both focused and unfocused states.

Current Behavior


The labels become centered only when focused.

Steps to Reproduce (for bugs)


https://codesandbox.io/s/x7wp3kx634

  1. Focus a textfield

Context

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | next |
| React | 16.3.2 |
| browser | Safari 11, Chrome 66 |

bug 馃悰 TextField good first issue

Most helpful comment

@oliviertassinari @gpoitch if we're not reverting #11215 (rel #1128 ) I can also get this one fixed, let me know.

All 3 comments

@gpoitch Thanks for raising the issue! The "only when centered" thing comes from #11215 by @pandaiolo.

I think that we should reset the text-align on the label for consistency with the input and make the label fit the container (width: 100%) when not shrinked (not focused and empty).
Do you want to work on that? :)

OT @oliviertassinari I understood your concerns about this seemingly little change, but I really thought it would have no impact. This is enlightening 馃槃

@oliviertassinari @gpoitch if we're not reverting #11215 (rel #1128 ) I can also get this one fixed, let me know.

Was this page helpful?
0 / 5 - 0 ratings