Skip to content

fix: ToggleButton provides an opt-in isAccessible variant for accessible checked colors#35837

Open
smhigley wants to merge 2 commits intomicrosoft:masterfrom
smhigley:toggle-appearance
Open

fix: ToggleButton provides an opt-in isAccessible variant for accessible checked colors#35837
smhigley wants to merge 2 commits intomicrosoft:masterfrom
smhigley:toggle-appearance

Conversation

@smhigley
Copy link
Contributor

@smhigley smhigley commented Mar 4, 2026

Previous Behavior

If the author doesn't have an icon in their ToggleButton, or doesn't change the icon between visually distinct variants for checked vs. unchecked, the ToggleButton doesn't meet a11y requirements for color contrast / not color alone for checked vs. unchecked in any appearance variant:

unchecked:
screenshot of 5 button appearance variants. All are grey or transparent except for the primary button which is blue

checked:
the same 5 buttons, except the backgrounds are slightly darker
Note: the outline variant does increase the border thickness, but since the border itself has less than 3:1 contrast, it doesn't help. In our story we do have an icon change so these specific buttons would be OK, but would fail without the icon.

New Behavior

An opt-in variant to each appearance that has actual contrasting color changes (or a stroke) to indicate the checked state. This was done w/ the design team, and checked w/ partners. In the future/v10, we should make the opt-in behavior the default, but for now it's opt-in.

unchecked:
Similar screenshot to the first checked buttons, but without icons

checked:
All five buttons have a blue background; the primary appearance has an inset white stroke.

I also added a story for the variant, and a11y docs for ToggleButton that explain when & why to use it.

Related Issue(s)

@smhigley smhigley requested review from a team and mainframev as code owners March 4, 2026 21:16
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.

1 participant