-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] Improve visual distinction between selected and focus-visible #16331
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Details of bundle changes.Comparing: eade31e...9bd33d3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://material.io/design/interaction/states.html: Since when does a tab item have a hover style? They keep changing the specification! That's an interesting new documentation page for me, I have never seen.
Regarding the pull request, I have seen the following issues:
- The focus opacity rate should be 12% (not 30%).
- The hover style should have precedence over the focus style (not the opposite).
https://material-components.github.io/material-components-web-catalog/#/component/select
Regarding the "Why?" question I was asking. My bias was the following. Most sequences of interactions are keyboard or mouse only, so why supporting both? But the specification specifically asks for it now, so ok, why not.
Could you rebase on the focus fix: #16323? I have a hard time triggering the focus style without it :)
That is what I meant with holistic approach. None of the values follow the spec right now. Focus is higher than selected and since selected is already 0.2 we shouldn't follow
How did you arrive at this conclusion? Material guidelines specifically state they should be additive (no point in addressing this here). |
At the same time, I don't think that we should allow the opacity to go above a threshold, it can become "ugly" (too dark). Would it work by reducing the selected opacity?
I was looking at the MCW implementation. However, YouTube implements an additive strategy. Is this a breaking change for overriding the styles? |
Maybe. Could you elaborate why this would be a bad thing? I want to reduce the possible breaking changes. I can close this and work on a complete overhaul of the states if that is more to your personal liking.
Perhaps. Again this is not something we can handwave away but have to carefully examine. The focus here is to create a minimal working difference between selected and focused state. |
Can we agree on the fact that a style change is breaking if it breaks somebody overrides? This pull request increases the specificity of a pseudo-class, is that breaking? If we release this change, people will try (issues/prs) to change the values: (is the contrast OK here?, I can't name it but something is off) The change I was proposing don't follow the specification but help to make a difference with the already selected value with minimal changes. It could be an intermediary step before a revamp of what we have, maybe for v5?
I agree, as much as not following the spec is not an option to handwave away if it can make things simpler. People value the good looking, functionnal aspect of the components, we should optimize for that first. |
I have sent two different proposals.
|
@eps1lon Do you have a preference on the direction we should take? I see limitation in all the direction we can go into. While this pull request is great for iterating around different ideas, maybe we could expose the different options available under #5186 and weight the pros and cons of each of them? |
I want to find consensus on a general direction first (proposal tomorrow). We're wasting a lot of time on minor implementation details. |
This sounds like a great idea! As long as it helps to refine the final solution, any step back is a step forward :) |
Adds
theme.palette.action.focusVisible
andtheme.palette.action.focusVisibleOpacity
which are used inListItem
andrippleVisible
classes.It has increased opacity compared to the
selected
state following https://material.io/design/interaction/states.html#anatomy. This introduces a minor color regression which I would consider a bugfix.This is not considered a complete solution which requires a more holistic approach implementing https://material.io/design/interaction/states.html. I'll draft a proposal next week and post it in #5186
Visual diffs are expected. Waiting for someone else to approve.