Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

fix(select): Disabled color and opacity #3513

Merged
merged 2 commits into from
Sep 5, 2018
Merged

Conversation

acdvorak
Copy link
Contributor

@acdvorak acdvorak commented Sep 5, 2018

What it does

  • Sets disabled color directly instead of giving the entire mdc-select element opacity: .38 and relying on the default browser styles for text color.

Example output

Before:

image

After:

image

Set disabled `color` directly instead of giving the entire `mdc-select` element `opacity: .38` and relying on the default browser styles for text color.
@kfranqueiro
Copy link
Contributor

kfranqueiro commented Sep 5, 2018

Why are we changing this? The default guidance is 38% opacity of the overall component, which is what the code is currently doing.

@acdvorak
Copy link
Contributor Author

acdvorak commented Sep 5, 2018

Look at the screenshots in the PR description. The existing version's text color is incorrect.

Browsers automatically style disabled <select> elements with color: graytext (WebKit). On top of that, we're applying 38% opacity. So the end result is opacity much less than 38%, which makes the text really hard to read.

In addition, the old version has transparent backgrounds, whereas the new one has opaque backgrounds.

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing this w/ Andy and comparing against current text field disabled styles... this is at least closer to what text field is currently doing. I don't think it's necessarily 100% correct, but it's a lot more consistent than before, and we need to revisit disabled styles overall in the future anyway.

@mdc-web-bot
Copy link
Collaborator

@acdvorak acdvorak merged commit 74bf144 into master Sep 5, 2018
@acdvorak acdvorak deleted the fix/select/disabled-color branch September 5, 2018 19:22
adrianschmidt pushed a commit to Lundalogik/material-components-web that referenced this pull request Sep 25, 2018
* Sets disabled `color` directly instead of giving the entire `mdc-select` element `opacity: .38` and relying on the default browser styles for text color.

![image](https://user-images.githubusercontent.com/409245/45083325-5c0eb300-b0b0-11e8-8917-957bc0306937.png)

![image](https://user-images.githubusercontent.com/409245/45083330-616bfd80-b0b0-11e8-8817-8e96cb59006f.png)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants