question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prefilled outlined MDCTextField - float-above modifier is not working well for the label

See original GitHub issue

The MDCTextField doco is saying:

When dealing with JS-driven text fields that already have values, you’ll want to ensure that you render mdc-floating-label with the mdc-floating-label–float-above modifier class. This will ensure that the label moves out of the way of the text field’s value and prevents a Flash Of Un-styled Content (FOUC).

However, it doesn’t work entirely well for the outlined fields. Before the JS arrives, the label is moved up indeed, however it’s striken through: image

Here is a sample page. To simulate late arrival of bundle.js, it doesnew MDCTextField when a button is pressed: https://label--float-above.glitch.me/

Here is the source: https://glitch.com/edit/#!/label--float-above

The reason why it’s happening is that MDCTextField adds two more classes to the DIV with mdc-notched-outline class: mdc-notched-outline--upgraded and mdc-notched-outline--notched

Expected behaviour: I guess that just adding mdc-floating-label--float-above modifier class should be enough. OR at least the doco should be changed.

MDC version: 3.1.1 Relative new Chrome used (77.0.3865.90) OS: Windows

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
new-mikhacommented, Nov 8, 2019

Also having the same problem here. Has there been a PR to fix this one?

@mrethical not from what I know. I tried to prepare such PR myself, the fix looks doable but not easy, so I gave up (at least for the moment)

0reactions
mrethicalcommented, Nov 8, 2019

Also having the same problem here. Has there been a PR to fix this one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MDC-Web: mdc-text-field--outlined with pre-filled value
This just works for me and triggers the floating label. Pay attention to other-number-tf-ex-input-container id: it must point to the container ...
Read more >
Text fields - Material Design
A text field doesn't require a label if a separate but clear label indicator is already displayed adjacent to the text field. Add...
Read more >
Text Field - Material Components for the Web
NOTE: Do not use mdc-text-field--outlined to style a full width text field. ... mdc-floating-label with the mdc-floating-label--float-above modifier class.
Read more >
packages/mdc-textfield/README.md · Gitee 极速下载/material ...
mdc-textfield ... HTML5 validation; Pre-filled; Baseline alignment ... with the mdc-text-field--label-floating modifier class, as well as mdc-floating-label ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found