Skip to content

Conversation

mahoneycm
Copy link
Contributor

@mahoneycm mahoneycm commented Nov 29, 2023

Summary

Enhances @lpsinger’s indeterminate checkbox styles with high contrast styles.

Important

This PR only affects styles. There is currently no functionality implementation with indeterminate checkboxes. Clicking the checkbox will toggle the checkbox but will not change the icon.

Breaking change

This is not a breaking change.

Related issue

Closes #5645

Related pull requests

Release note will be added for feature branch

#5549
#5650

Preview link

Standard checkbox story →
Indeterminate checkboxes story →
Indeterminate checkbox tiles story →

Problem statement

#5549 introduces indeterminate checkbox styles. When viewed in high contrast modes, the icon is not always visible and checkboxes can still be visibly toggled.

Kapture.2023-10-23.at.13.16.41.mp4

Solution

Use the SelectedItem high contrast token to maintain a visible indeterminate icon. This change also visually enhances checked checkbox styles as well.

Using SelectedItem will allow USWDS checkbox styles to reflect high contrast color customization set by the user.

Develop:

Dark

image

Light

image

using SelectedItem:

Dark

image

Light
image

Radio buttons

I opted to not change the radio selected color due to its low color contrast in light high contrast themes

Develop:

image

SelectedItem :

image

Contrast Ratio: 1.3:1

Testing and review

  1. Visit the indeterminate checkbox test story.
  2. Activate high contrast mode.
  3. Confirm check and indeterminate icons are visible in light and dark modes
  4. Click the indeterminate checkbox.
  5. Confirm indeterminate icon does not disappear.
  6. Consider next steps for functionality implementations.
Activating high contrast mode on chrome

  1. Open devTools
  2. Open the menu using the three dot icon
  3. Highlight More tools and select Rendering
  4. Scroll down to find “Emulate CSS media feature forced-colors and activate.
  5. You can also change light and dark themes using the “Emulate CSS media feature prefers-color-scheme”

Testing checklist

  • Check is visible in light and dark high contrast themes
  • Indeterminate icon is visible in light and dark themes

@mahoneycm mahoneycm changed the base branch from develop to checkbox-indeterminate-feature-branch November 29, 2023 21:23
@mahoneycm mahoneycm mentioned this pull request Jan 4, 2024
3 tasks
@mahoneycm mahoneycm marked this pull request as ready for review January 22, 2024 19:49
Comment on lines +145 to +160
&:indeterminate,
&[data-indeterminate] {
&,
&:checked {
@include format-input {
@include add-background-svg($input-indeterminate);
background-position: center center;
background-size: units(1.5) auto;

@media (forced-colors: active) {
@include add-background-svg("checkbox-indeterminate-alt");
background-color: color(SelectedItem);
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved styles above disabled content

@mahoneycm mahoneycm requested review from amyleadem and mejiaj January 22, 2024 21:18
Copy link
Contributor

@amyleadem amyleadem left a comment

Choose a reason for hiding this comment

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

This looks good to me!
Here is what I see using Chrome dev tools forced-colors: active rendering mode:

image

Copy link
Contributor

@mejiaj mejiaj left a comment

Choose a reason for hiding this comment

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

Component styles look good.


@mahoneycm is there a release note for this work?

@mejiaj mejiaj requested a review from thisisdano January 30, 2024 19:21
@thisisdano thisisdano merged commit 3c3770a into checkbox-indeterminate-feature-branch Feb 22, 2024
@thisisdano thisisdano deleted the cm-checkbox-indeterminate-high-contrast branch February 22, 2024 20:49
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.

USWDS - Checkbox: Indeterminate checkboxes need high contrast styles
4 participants