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

Fix too low contrast in subtitles for selected RadioGroup.Radios #1695

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Sep 3, 2024

This PR fixes an accessibility issue in RadioGroup component, where the contrast between the text color used in subtitles and the background color used in selected radios, is too low.

In order to fix it, we now set a darker shade of grey in the subtitles when the radio is hovered or selected.

See before and after:

image
image

Additionally, selected and hover radio background color is now set with an opacity lower than 100%. This ensures there's always a different color for those, even if the container's background color is the same as the color used for selected radios.

See how they look when the container has the former background color:

Before:

radio-no-alpha-2024-09-03_12.13.11.mp4

After:

radio-alpha-2024-09-03_12.13.44.mp4

name: 'selected item with subtitle',
content: () => createComponent({ selected: 'four' }),
},
]),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

axe-core catched the accessibility issue in other project, but we were missing a test with selected radios.

These tests fail in main.

@robertknight
Copy link
Member

On macOS the thinner font looks like:

macOS thin font

An alternative would be to make the text one shade darker when the radio is selected or hovered:

macOS darker when selected

On my system I think I find this a little easier to read.

@acelaya
Copy link
Contributor Author

acelaya commented Sep 3, 2024

An alternative would be to make the text one shade darker when the radio is selected or hovered

I actually thought about this, but forgot to test it! Let me try that.

@acelaya
Copy link
Contributor Author

acelaya commented Sep 3, 2024

On macOS the thinner font looks like:

macOS thin font An alternative would be to make the text one shade darker when the radio is selected or hovered: macOS darker when selected On my system I think I find this a little easier to read.

Yeah, I think this is a better solution. I have changed it.

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (6b219d8) to head (9d2a378).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1695   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           66        66           
  Lines         1114      1115    +1     
  Branches       434       435    +1     
=========================================
+ Hits          1114      1115    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM

@acelaya acelaya merged commit 49ffd4f into main Sep 4, 2024
4 checks passed
@acelaya acelaya deleted the fix-radio-contrast branch September 4, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants