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.

Add invalid styles to mdc-select

See original GitHub issue

What MDC-Web Version are you using?

0.2.0

What browser(s) is this bug affecting?

All browsers, but most visible in Safari.

What OS are you using?

OSX

What are the steps to reproduce the bug?

  1. Create an mdc-select component in a form.
  2. Add a default option with no value.
  3. Add some more options with values.
  4. Add the required attribute to the select.
  5. In the browser, change from the default option.
  6. Change back to the default option.

The mdc-select component does not apply a class such as mdc-select--invalid nor does it appear to exist in the source code. This should also happen when the form is submitted in an invalid state.

What is the expected behavior?

This should work the same as it already does for mdc-textfield, expected to automatically apply and remove a class such as mdc-select--invalid when the select changes validation state.

What is the actual behavior?

No class is applied and in Safari there is no visual indication that the field is invalid.

Any other information you believe would be useful?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
djensen47commented, Feb 9, 2018

@lynnjepsen I went through the code in material-components-web/packages/mdc-select/ and, unless I’m missing something, this has not been implemented. I also didn’t see any references to this in any of the CHANGELOG.md notes.

Please re-open. Thanks!

7reactions
traviskaufmancommented, Mar 3, 2017

Work to be done:

  • Add mdc-select--invalid style
  • Add :invalid style (for native control)
  • Document these styles
  • Document that we do not provide custom validity functions/logic for JS select, only styles
  • Ensure invalid styles work for dark mode
  • Update demo to showcase functionality
Read more comments on GitHub >

github_iconTop Results From Across the Web

html - Material Design Components select menu not rendering ...
I just added this code to solve this problem: .mdc-select__native-control ...
Read more >
invalid - CSS: Cascading Style Sheets - MDN Web Docs
The :invalid CSS pseudo-class represents any , , or other element whose contents fail to validate.
Read more >
packages/mdc-select/README.md · Gitee 极速下载/material ...
To style a select menu as required and enable validation, add the mdc-select--required class to the mdc-select element and set the aria-required attribute...
Read more >
React Material Web Components | Select Menus - RMWC
Using CSS Loader. import '@rmwc/select/styles';. Or include stylesheets. '@rmwc/select/select.css';; '@material/select/dist/mdc.select.css'; ...
Read more >
Card-mod - Add css styles to any lovelace card
Important; } style: | # This is wrong # ha-tile-info$: ... entity: input_select.robo_mop style: | :host { --mdc-select-ink-color: {{ 'white' ...
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