material-components-web icon indicating copy to clipboard operation
material-components-web copied to clipboard

mdc-select default browser styling - Edge

Open kvdheuvel opened this issue 8 years ago • 4 comments

What MDC Web Version are you using?

0.41.0

What browser(s) is this bug affecting?

We got an issue in Edge, but the styling is set for all browsers.

What OS are you using?

Windows 10

What are the steps to reproduce the bug?

Open the mdc-select in Edge and select an value. Reopen the select and you will see that the selected value can't be seen because the background color and text color are white.

I've created an codepen based on the provided template: https://codepen.io/anon/pen/NEjeYw

What is the expected behavior?

The selected option should be readable.

What is the actual behavior?

Option background-color & color are the same color.

Any other information you believe would be useful?

/

kvdheuvel avatar Nov 15 '18 14:11 kvdheuvel

Thanks for reporting this issue @kvdheuvel!

Seems like a bug on Edge where it doesn't allow CSS variables on native select > option element. Here is a quick example on jsfiddle that demonstrates this bug.

I just sent a PR #4089 to fix it.

abhiomkar avatar Nov 15 '18 16:11 abhiomkar

Hello @abhiomkar,

I don't think that the CSS variables are the problem. I think the problem is that the selected option has the same color as --mdc-theme-surface (both white). If you change the --mdc-theme-surface color to let's say green you can see (read) the selected option because that text is white.

kvdheuvel avatar Nov 16 '18 07:11 kvdheuvel

You're right. If I set the background color to something else it changes the color of option element on edge except when I set it to hard coded value instead of using CSS variable. See this example. I find this weird. Browser might be preventing it from doing this for accessibility reasons.

Also I'm not able to change the text color of option element on edge, it only lets me change the background color.

I'm inclined towards removing styles from native option element altogether.

abhiomkar avatar Nov 16 '18 16:11 abhiomkar

Maybe that would be the best option in this situation.

kvdheuvel avatar Nov 20 '18 07:11 kvdheuvel