Skip to content

Commit b031803

Browse files
committed
fixup
1 parent 9eda3d9 commit b031803

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix: update Switch component to conditionally render CircleFilled in indicator",
4+
"packageName": "@fluentui/react-switch",
5+
"email": "dmytrokirpa@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export const useSwitch_unstable = (props: SwitchProps, ref: React.Ref<HTMLInputE
2222

2323
const baseState = useSwitchBase_unstable(baseProps, ref);
2424

25+
baseState.indicator.children ??= <CircleFilled />;
26+
2527
return {
2628
...baseState,
2729
size,
@@ -61,7 +63,7 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref<H
6163
elementType: 'div',
6264
});
6365
const indicator = slot.always(props.indicator, {
64-
defaultProps: { 'aria-hidden': true, children: <CircleFilled /> },
66+
defaultProps: { 'aria-hidden': true },
6567
elementType: 'div',
6668
});
6769
const input = slot.always(props.input, {

0 commit comments

Comments
 (0)