Skip to content
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

Better contrast for current item in light dropdown #6672

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

distantnative
Copy link
Member

Description

Summary of changes

  • Improve color contrast for current item in light theme dropdown
Screenshot 2024-09-14 at 11 23 03 AM

Reasoning

Using color-blue-700 is actually not fully compliant with WCAG AA, only achieving 4.43:1 contrast ratio.
However the next available color step color-blue-800 is way too dark to be a noticeable difference:
Screenshot 2024-09-14 at 11 23 22 AM

How do we want to deal with such situations. Break out of our color system? #2A78C6 would be conforming and close to color-blue-700.

@distantnative distantnative added the type: a11y 👐 Concerns a change that would make it more accessible to more people label Sep 14, 2024
@distantnative distantnative added this to the 4.5.0 milestone Sep 14, 2024
@distantnative distantnative self-assigned this Sep 14, 2024
@distantnative distantnative linked an issue Sep 14, 2024 that may be closed by this pull request
@distantnative distantnative requested a review from a team September 14, 2024 09:29
@bastianallgeier
Copy link
Member

With the dark theme on the horizon, I start to wonder if we should move to certain purpose-driven variables instead of those color values.

@distantnative
Copy link
Member Author

Like another layer in between: blue-on-dark, blue-on-light?

@bastianallgeier
Copy link
Member

Probably even less color dependent. I'm not sure how verbose we need to be, but if we think about variables that could stick around with any design change, we would probably need something like

--color-primary-dropdown-link-active
--color-primary-dropdown-link

--color-secondary-dropdown-link-active
--color-secondary-dropdown-link

Super unsure about primary and secondary, but we need some sort of description for the dark/white dropdowns that are also independent from the current theme.

@distantnative
Copy link
Member Author

What would primary and what would secondary be?

@bastianallgeier
Copy link
Member

The naming really isn't great. Dark & light make a lot more sense in general, but when we flip it in the dark theme, we can't also flip the wording. That's where it gets messy. I think "primary" would probably be the dark ones, because they are the common ones and light would be "secondary". But maybe it could also be something like:

--color-dropdown-link-active
--color-dropdown-link

--color-dropdown-inverted-link-active
--color-dropdown-inverted-link

@distantnative
Copy link
Member Author

@bastianallgeier I get your approach but we have that in so many places (e.g. --color-white, --color-black are semantical nonsense in dark mode). I'd rather approach that with one common strategy in a separate PR then just start here in this PR.

@bastianallgeier
Copy link
Member

You are right. To change the variable system would be way too much for this PR.

What about going for the darker color, which is also our default link color, but at the same time we introduce some active icon for dropdowns? I think @nilshoerrmann suggested this somewhere and it would definitely be the most accessible solution – independent from our color choice and the independent from the theme.

Screenshot 2024-09-23 at 15 35 00

@nilshoerrmann
Copy link
Contributor

Anything that makes the current state obvious without relying on colours would be great. Either a different font weight or a selected state icon would be great 👍

I think I'd prefer the icon because it's a common thing people know and because it doesn't have side effects like changing text widths.

@nilshoerrmann
Copy link
Contributor

nilshoerrmann commented Sep 23, 2024

Having a something like a checkmark would also help distinguish the focus from the selected state. I personally always think the focussed element is selected, even while seeing the colours.

@bastianallgeier
Copy link
Member

I've built a quick version that could work. I think unlike on macOS, we can't properly put it in front of the dropdown item icon without really changing the overall design of the dropdown items. Putting it at the end seems to work really well though.

Screenshot 2024-09-23 at 17 12 22
Screenshot 2024-09-23 at 17 12 31

@distantnative
Copy link
Member Author

@bastianallgeier I think this is great, approved :)

@distantnative distantnative merged commit daa4403 into develop-minor Sep 23, 2024
4 checks passed
@distantnative distantnative deleted the fix/6664-dropdown-current-a11y branch September 23, 2024 16:42
@nilshoerrmann
Copy link
Contributor

Just to get that right: develop-minor, is that going to be 4.5.x?

@distantnative
Copy link
Member Author

4.5.0 yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: a11y 👐 Concerns a change that would make it more accessible to more people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panel: Low text contrast for selected dropdown items
3 participants