Skip to content

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

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

fix: ToggleButton provides an opt-in isAccessible variant for accessible checked colors#35837
smhigley wants to merge 3 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
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-button
ToggleButton
50.938 kB
10.877 kB
53.344 kB
11.081 kB
2.406 kB
204 B
react-components
react-components: entire library
1.292 MB
323.177 kB
1.294 MB
323.411 kB
2.406 kB
234 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-breadcrumb
@fluentui/react-breadcrumb - package
114.911 kB
31.405 kB
react-button
Button
33.962 kB
9.022 kB
react-button
CompoundButton
40.843 kB
10.379 kB
react-button
MenuButton
38.866 kB
10.414 kB
react-button
SplitButton
47.663 kB
12.057 kB
react-card
Card - All
105.131 kB
29.449 kB
react-card
Card
97.799 kB
27.572 kB
react-card
CardFooter
12.756 kB
5.109 kB
react-card
CardHeader
15.289 kB
5.972 kB
react-card
CardPreview
12.84 kB
5.248 kB
react-charts
AreaChart
412.28 kB
126.425 kB
react-charts
DeclarativeChart
762.928 kB
220.39 kB
react-charts
DonutChart
322.715 kB
96.946 kB
react-charts
FunnelChart
314.268 kB
93.991 kB
react-charts
GanttChart
395.399 kB
119.927 kB
react-charts
GaugeChart
322.146 kB
96.373 kB
react-charts
GroupedVerticalBarChart
403.269 kB
122.494 kB
react-charts
HeatMapChart
397.47 kB
121.788 kB
react-charts
HorizontalBarChart
302.442 kB
89.116 kB
react-charts
HorizontalBarChartWithAxis
63 B
83 B
react-charts
Legends
242.388 kB
71.585 kB
react-charts
LineChart
423.621 kB
128.472 kB
react-charts
PolarChart
351.333 kB
107.364 kB
react-charts
SankeyChart
220.381 kB
67.866 kB
react-charts
ScatterChart
402.996 kB
122.603 kB
react-charts
Sparkline
91.393 kB
28.708 kB
react-charts
VerticalBarChart
439.74 kB
128.215 kB
react-charts
VerticalStackedBarChart
409.183 kB
123.955 kB
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
236.537 kB
68.697 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-dialog
Dialog (including children components)
102.12 kB
30.394 kB
react-message-bar
MessageBar (all components)
23.294 kB
8.63 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-tag-picker
@fluentui/react-tag-picker - package
186.596 kB
55.849 kB
react-teaching-popover
TeachingPopover
112.414 kB
34.219 kB
react-timepicker-compat
TimePicker
108.174 kB
35.695 kB
react-tree
FlatTree
147.635 kB
42.134 kB
react-tree
PersonaFlatTree
149.463 kB
42.517 kB
react-tree
PersonaTree
145.523 kB
41.338 kB
react-tree
Tree
143.701 kB
40.972 kB
🤖 This report was generated against 2f037abe0ee131efaf68504d37ac9eadc000f6ea

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Charts-DonutChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Charts-DonutChart.Dynamic.default.chromium.png 5581 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png 404 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 198 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 966 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests-react-components/TagPicker.disabled.disabled input hover.chromium.png 677 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant