Skip to content

Commit 175abf2

Browse files
authored
fix: update react-combobox multiselect checkbox styles to match Checkbox (#26509)
1 parent 62c47b1 commit 175abf2

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: update multiselect checkbox styles to match checkbox",
4+
"packageName": "@fluentui/react-combobox",
5+
"email": "sarah.higley@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-combobox/src/components/Listbox/useListboxStyles.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const useStyles = makeStyles({
1818
flexDirection: 'column',
1919
minWidth: '160px',
2020
overflowY: 'auto',
21+
...shorthands.outline('1px', 'solid', tokens.colorTransparentStroke),
2122
...shorthands.padding(tokens.spacingHorizontalXS),
2223
rowGap: tokens.spacingHorizontalXXS,
2324
},

packages/react-components/react-combobox/src/components/Option/__snapshots__/Option.test.tsx.snap

+5-20
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@ exports[`Option renders a default multi-select state 1`] = `
1111
<span
1212
aria-hidden="true"
1313
class="fui-Option__checkIcon"
14-
>
15-
<svg
16-
aria-hidden="true"
17-
class=""
18-
fill="currentColor"
19-
height="1em"
20-
viewBox="0 0 20 20"
21-
width="1em"
22-
xmlns="http://www.w3.org/2000/svg"
23-
>
24-
<path
25-
d="M3 6a3 3 0 013-3h8a3 3 0 013 3v8a3 3 0 01-3 3H6a3 3 0 01-3-3V6zm3-1.5c-.83 0-1.5.67-1.5 1.5v8c0 .83.67 1.5 1.5 1.5h8c.83 0 1.5-.67 1.5-1.5V6c0-.83-.67-1.5-1.5-1.5H6z"
26-
fill="currentColor"
27-
/>
28-
</svg>
29-
</span>
14+
/>
3015
Default Option
3116
</div>
3217
</div>
@@ -80,13 +65,13 @@ exports[`Option renders a selected multi-select state 1`] = `
8065
aria-hidden="true"
8166
class=""
8267
fill="currentColor"
83-
height="1em"
84-
viewBox="0 0 20 20"
85-
width="1em"
68+
height="12"
69+
viewBox="0 0 12 12"
70+
width="12"
8671
xmlns="http://www.w3.org/2000/svg"
8772
>
8873
<path
89-
d="M6 3a3 3 0 00-3 3v8a3 3 0 003 3h8a3 3 0 003-3V6a3 3 0 00-3-3H6zm7.85 4.85l-5 5a.5.5 0 01-.7 0l-2-2a.5.5 0 01.7-.7l1.65 1.64 4.65-4.64a.5.5 0 01.7.7z"
74+
d="M9.76 3.2c.3.29.32.76.04 1.06l-4.25 4.5a.75.75 0 01-1.08.02L2.22 6.53a.75.75 0 011.06-1.06l1.7 1.7L8.7 3.24a.75.75 0 011.06-.04z"
9075
fill="currentColor"
9176
/>
9277
</svg>

packages/react-components/react-combobox/src/components/Option/useOption.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { getNativeElementProps, resolveShorthand, useId, useMergedRefs } from '@fluentui/react-utilities';
33
import { useContextSelector } from '@fluentui/react-context-selector';
4-
import { CheckmarkFilled, CheckboxUncheckedFilled, CheckboxCheckedFilled } from '@fluentui/react-icons';
4+
import { CheckmarkFilled, Checkmark12Filled } from '@fluentui/react-icons';
55
import { ComboboxContext } from '../../contexts/ComboboxContext';
66
import { ListboxContext } from '../../contexts/ListboxContext';
77
import type { OptionValue } from '../../utils/OptionCollection.types';
@@ -76,9 +76,9 @@ export const useOption_unstable = (props: OptionProps, ref: React.Ref<HTMLElemen
7676
});
7777

7878
// check icon
79-
let CheckIcon = <CheckmarkFilled />;
79+
let CheckIcon: React.ReactNode = <CheckmarkFilled />;
8080
if (multiselect) {
81-
CheckIcon = selected ? <CheckboxCheckedFilled /> : <CheckboxUncheckedFilled />;
81+
CheckIcon = selected ? <Checkmark12Filled /> : '';
8282
}
8383

8484
const onClick = (event: React.MouseEvent<HTMLDivElement>) => {

packages/react-components/react-combobox/src/components/Option/useOptionStyles.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,30 @@ const useStyles = makeStyles({
8686
},
8787
},
8888

89-
multiselectCheck: {
90-
color: tokens.colorNeutralForeground3,
91-
fontSize: tokens.fontSizeBase500,
89+
selectedCheck: {
9290
visibility: 'visible',
9391
},
9492

95-
selectedCheck: {
93+
multiselectCheck: {
94+
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
95+
...shorthands.borderRadius(tokens.borderRadiusSmall),
96+
boxSizing: 'border-box',
97+
98+
display: 'flex',
99+
alignItems: 'center',
100+
justifyContent: 'center',
101+
102+
fill: 'currentColor',
103+
fontSize: '12px',
104+
height: '16px',
105+
width: '16px',
96106
visibility: 'visible',
97107
},
98108

99109
selectedMultiselectCheck: {
100-
color: tokens.colorBrandBackground,
110+
backgroundColor: tokens.colorCompoundBrandBackground,
111+
color: tokens.colorNeutralForegroundInverted,
112+
...shorthands.borderColor(tokens.colorCompoundBrandBackground),
101113
},
102114

103115
checkDisabled: {

0 commit comments

Comments
 (0)