From 29c9b5543ab13abe839966c60423ce54639fb642 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 08:50:29 +0000 Subject: [PATCH 1/6] Initial plan From a9f472835a29d8febc3ebc44e922e99f3443dfed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:15:29 +0000 Subject: [PATCH 2/6] feat: add disabledFocusable prop to Switch component Co-authored-by: mainframev <14054752+mainframev@users.noreply.github.com> --- ...uentui-react-switch-disabledFocusable.json | 7 ++ .../library/etc/react-switch.api.md | 3 +- .../src/components/Switch/Switch.test.tsx | 36 ++++++++ .../src/components/Switch/Switch.types.ts | 11 ++- .../src/components/Switch/useSwitch.tsx | 28 ++++-- .../Switch/useSwitchStyles.styles.ts | 90 +++++++++++++++++++ .../src/Switch/SwitchDisabled.stories.tsx | 2 + 7 files changed, 170 insertions(+), 7 deletions(-) create mode 100644 change/@fluentui-react-switch-disabledFocusable.json diff --git a/change/@fluentui-react-switch-disabledFocusable.json b/change/@fluentui-react-switch-disabledFocusable.json new file mode 100644 index 0000000000000..702b96bfafeda --- /dev/null +++ b/change/@fluentui-react-switch-disabledFocusable.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: add disabledFocusable prop to Switch component", + "packageName": "@fluentui/react-switch", + "email": "copilot@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-switch/library/etc/react-switch.api.md b/packages/react-components/react-switch/library/etc/react-switch.api.md index 2829567138398..c88091eca1ca1 100644 --- a/packages/react-components/react-switch/library/etc/react-switch.api.md +++ b/packages/react-components/react-switch/library/etc/react-switch.api.md @@ -33,6 +33,7 @@ export type SwitchOnChangeData = { // @public export type SwitchProps = Omit, 'input'>, 'checked' | 'defaultChecked' | 'onChange' | 'size'> & { checked?: boolean; + disabledFocusable?: boolean; defaultChecked?: boolean; labelPosition?: 'above' | 'after' | 'before'; size?: 'small' | 'medium'; @@ -48,7 +49,7 @@ export type SwitchSlots = { }; // @public -export type SwitchState = ComponentState & Required>; +export type SwitchState = ComponentState & Required>; // @public export const useSwitch_unstable: (props: SwitchProps, ref: React_2.Ref) => SwitchState; diff --git a/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx b/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx index f2a13c7f70af4..dd6aec50c2550 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx @@ -140,6 +140,42 @@ describe('Switch', () => { expect(checked.checked).toBe(true); }); + it('does not trigger a change in the checked state if it is disabledFocusable', () => { + const { getAllByRole } = render( + <> + + + , + ); + const [unchecked, checked] = getAllByRole('switch') as HTMLInputElement[]; + + expect(unchecked.checked).toBe(false); + userEvent.click(unchecked); + expect(unchecked.checked).toBe(false); + + expect(checked.checked).toBe(true); + userEvent.click(checked); + expect(checked.checked).toBe(true); + }); + + it('can be focused when disabledFocusable has been passed', () => { + const { getByRole } = render(); + const input = getByRole('switch'); + + expect(document.activeElement).not.toEqual(input); + userEvent.tab(); + expect(document.activeElement).toEqual(input); + }); + + it('does not call onChange when disabledFocusable has been passed', () => { + const onChange = jest.fn, SwitchOnChangeData]>(); + const { getByRole } = render(); + const input = getByRole('switch'); + + userEvent.click(input); + expect(onChange).not.toHaveBeenCalled(); + }); + it('calls onChange with the correct value', () => { const onChange = jest.fn, SwitchOnChangeData]>(); const { getByRole } = render(); diff --git a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts index f36ec83c1806f..aab46db447289 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts +++ b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts @@ -51,6 +51,15 @@ export type SwitchProps = Omit< */ checked?: boolean; + /** + * Whether the switch should be disabled and focusable. This is used in scenarios where it is important to keep a + * consistent tab order for screen reader and keyboard users. The primary example of this pattern is when the + * disabled switch is in a list or a form and is seldom used for standalone switches. + * + * @default false + */ + disabledFocusable?: boolean; + /** * Defines whether the Switch is initially in a checked state or not when rendered. * @@ -87,7 +96,7 @@ export type SwitchBaseProps = Omit; /** * State used in rendering Switch */ -export type SwitchState = ComponentState & Required>; +export type SwitchState = ComponentState & Required>; /** * Switch base state, excluding design-related state like size diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx index e3ad1dfa4b5b8..ee7ed20c85e1a 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx @@ -38,12 +38,13 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref, if any props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true }); - const { checked, defaultChecked, disabled, labelPosition = 'after', onChange, required } = props; + const { checked, defaultChecked, disabled, disabledFocusable = false, labelPosition = 'after', onChange, required } = + props; const nativeProps = getPartitionedNativeProps({ props, primarySlotTagName: 'input', - excludedPropNames: ['checked', 'defaultChecked', 'onChange'], + excludedPropNames: ['checked', 'defaultChecked', 'onChange', 'disabledFocusable'], }); const id = useId('switch-', nativeProps.primary.id); @@ -57,15 +58,32 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref onChange?.(ev, { checked: ev.currentTarget.checked })); + input.onChange = mergeCallbacks(input.onChange, ev => { + if (disabledFocusable) { + ev.preventDefault(); + } else { + onChange?.(ev, { checked: ev.currentTarget.checked }); + } + }); const label = slot.optional(props.label, { - defaultProps: { disabled, htmlFor: id, required, size: 'medium' }, + defaultProps: { disabled: disabled || disabledFocusable, htmlFor: id, required, size: 'medium' }, elementType: Label, }); return { + disabledFocusable, labelPosition, components: { root: 'div', indicator: 'div', input: 'input', label: Label }, diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts b/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts index d32acf6abe308..b47f5e2177318 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts @@ -177,6 +177,58 @@ const useInputBaseClassName = makeResetStyles({ }, }, + // DisabledFocusable (both checked and unchecked) - must come after :enabled: blocks to override them + '[aria-disabled="true"]': { + cursor: 'default', + + [`& ~ .${switchClassNames.indicator}`]: { + color: tokens.colorNeutralForegroundDisabled, + }, + }, + + // DisabledFocusable and unchecked + // Uses :not(:checked) to match specificity of :enabled:not(:checked) and override it + '[aria-disabled="true"]:not(:checked)': { + [`& ~ .${switchClassNames.indicator}`]: { + color: tokens.colorNeutralForegroundDisabled, + borderColor: tokens.colorNeutralStrokeDisabled, + }, + + [`& ~ .${switchClassNames.label}`]: { + cursor: 'default', + color: tokens.colorNeutralForegroundDisabled, + }, + + ':hover, :hover:active': { + [`& ~ .${switchClassNames.indicator}`]: { + color: tokens.colorNeutralForegroundDisabled, + borderColor: tokens.colorNeutralStrokeDisabled, + }, + }, + }, + + // DisabledFocusable and checked + // Uses :checked to match specificity of :enabled:checked and override it + '[aria-disabled="true"]:checked': { + [`& ~ .${switchClassNames.indicator}`]: { + backgroundColor: tokens.colorNeutralBackgroundDisabled, + color: tokens.colorNeutralForegroundDisabled, + borderColor: tokens.colorTransparentStrokeDisabled, + }, + + [`& ~ .${switchClassNames.label}`]: { + cursor: 'default', + color: tokens.colorNeutralForegroundDisabled, + }, + + ':hover, :hover:active': { + [`& ~ .${switchClassNames.indicator}`]: { + backgroundColor: tokens.colorNeutralBackgroundDisabled, + borderColor: tokens.colorTransparentStrokeDisabled, + }, + }, + }, + // Disabled and unchecked ':disabled:not(:checked)': { [`& ~ .${switchClassNames.indicator}`]: { @@ -227,6 +279,44 @@ const useInputBaseClassName = makeResetStyles({ color: 'Canvas', }, }, + // DisabledFocusable forced-colors: must come after :enabled:checked to override Highlight styles + // Use :not(:checked) and :checked variants to match the specificity of :enabled:not(:checked) and :enabled:checked + '[aria-disabled="true"]:not(:checked)': { + [`& ~ .${switchClassNames.indicator}`]: { + color: 'GrayText', + borderColor: 'GrayText', + }, + + [`& ~ .${switchClassNames.label}`]: { + color: 'GrayText', + }, + + ':hover, :hover:active': { + [`& ~ .${switchClassNames.indicator}`]: { + color: 'GrayText', + borderColor: 'GrayText', + }, + }, + }, + '[aria-disabled="true"]:checked': { + [`& ~ .${switchClassNames.indicator}`]: { + backgroundColor: 'ButtonFace', + color: 'GrayText', + borderColor: 'GrayText', + }, + + [`& ~ .${switchClassNames.label}`]: { + color: 'GrayText', + }, + + ':hover, :hover:active': { + [`& ~ .${switchClassNames.indicator}`]: { + backgroundColor: 'ButtonFace', + color: 'GrayText', + borderColor: 'GrayText', + }, + }, + }, }, }); diff --git a/packages/react-components/react-switch/stories/src/Switch/SwitchDisabled.stories.tsx b/packages/react-components/react-switch/stories/src/Switch/SwitchDisabled.stories.tsx index 46fd56a2c2d27..e384c5c364dca 100644 --- a/packages/react-components/react-switch/stories/src/Switch/SwitchDisabled.stories.tsx +++ b/packages/react-components/react-switch/stories/src/Switch/SwitchDisabled.stories.tsx @@ -11,6 +11,8 @@ export const Disabled = (): JSXElement => (
+ +
); From 48c9dbca5a1b1469f2ce5c2aa24bc8385f1a9843 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:55:29 +0000 Subject: [PATCH 3/6] fix(react-switch): address review feedback on disabledFocusable implementation Co-authored-by: mainframev <14054752+mainframev@users.noreply.github.com> --- .../src/components/Switch/Switch.types.ts | 5 +- .../src/components/Switch/useSwitch.tsx | 5 + .../Switch/useSwitchStyles.styles.ts | 104 ++---------------- 3 files changed, 14 insertions(+), 100 deletions(-) diff --git a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts index aab46db447289..9950b3692c289 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts +++ b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts @@ -52,9 +52,8 @@ export type SwitchProps = Omit< checked?: boolean; /** - * Whether the switch should be disabled and focusable. This is used in scenarios where it is important to keep a - * consistent tab order for screen reader and keyboard users. The primary example of this pattern is when the - * disabled switch is in a list or a form and is seldom used for standalone switches. + * When set, allows the Switch to be focusable even when it has been disabled. This is used in scenarios where it is + * important to keep a consistent tab order for screen reader and keyboard users. * * @default false */ diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx index ee7ed20c85e1a..df6d94e9f8d15 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx @@ -78,6 +78,11 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref { + if (disabledFocusable && (ev.key === ' ' || ev.key === 'Enter')) { + ev.preventDefault(); + } + }); const label = slot.optional(props.label, { defaultProps: { disabled: disabled || disabledFocusable, htmlFor: id, required, size: 'medium' }, elementType: Label, diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts b/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts index b47f5e2177318..6fc02fb187816 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitchStyles.styles.ts @@ -115,7 +115,7 @@ const useInputBaseClassName = makeResetStyles({ }, // Disabled (both checked and unchecked) - ':disabled': { + ':disabled, &[aria-disabled="true"]': { cursor: 'default', [`& ~ .${switchClassNames.indicator}`]: { @@ -129,7 +129,7 @@ const useInputBaseClassName = makeResetStyles({ }, // Enabled and unchecked - ':enabled:not(:checked)': { + ':enabled:not(:checked):not([aria-disabled="true"])': { [`& ~ .${switchClassNames.indicator}`]: { color: tokens.colorNeutralStrokeAccessible, borderColor: tokens.colorNeutralStrokeAccessible, @@ -155,7 +155,7 @@ const useInputBaseClassName = makeResetStyles({ }, // Enabled and checked - ':enabled:checked': { + ':enabled:checked:not([aria-disabled="true"])': { [`& ~ .${switchClassNames.indicator}`]: { backgroundColor: tokens.colorCompoundBrandBackground, color: tokens.colorNeutralForegroundInverted, @@ -177,67 +177,15 @@ const useInputBaseClassName = makeResetStyles({ }, }, - // DisabledFocusable (both checked and unchecked) - must come after :enabled: blocks to override them - '[aria-disabled="true"]': { - cursor: 'default', - - [`& ~ .${switchClassNames.indicator}`]: { - color: tokens.colorNeutralForegroundDisabled, - }, - }, - - // DisabledFocusable and unchecked - // Uses :not(:checked) to match specificity of :enabled:not(:checked) and override it - '[aria-disabled="true"]:not(:checked)': { - [`& ~ .${switchClassNames.indicator}`]: { - color: tokens.colorNeutralForegroundDisabled, - borderColor: tokens.colorNeutralStrokeDisabled, - }, - - [`& ~ .${switchClassNames.label}`]: { - cursor: 'default', - color: tokens.colorNeutralForegroundDisabled, - }, - - ':hover, :hover:active': { - [`& ~ .${switchClassNames.indicator}`]: { - color: tokens.colorNeutralForegroundDisabled, - borderColor: tokens.colorNeutralStrokeDisabled, - }, - }, - }, - - // DisabledFocusable and checked - // Uses :checked to match specificity of :enabled:checked and override it - '[aria-disabled="true"]:checked': { - [`& ~ .${switchClassNames.indicator}`]: { - backgroundColor: tokens.colorNeutralBackgroundDisabled, - color: tokens.colorNeutralForegroundDisabled, - borderColor: tokens.colorTransparentStrokeDisabled, - }, - - [`& ~ .${switchClassNames.label}`]: { - cursor: 'default', - color: tokens.colorNeutralForegroundDisabled, - }, - - ':hover, :hover:active': { - [`& ~ .${switchClassNames.indicator}`]: { - backgroundColor: tokens.colorNeutralBackgroundDisabled, - borderColor: tokens.colorTransparentStrokeDisabled, - }, - }, - }, - // Disabled and unchecked - ':disabled:not(:checked)': { + ':disabled:not(:checked), &[aria-disabled="true"]:not(:checked)': { [`& ~ .${switchClassNames.indicator}`]: { borderColor: tokens.colorNeutralStrokeDisabled, }, }, // Disabled and checked - ':disabled:checked': { + ':disabled:checked, &[aria-disabled="true"]:checked': { [`& ~ .${switchClassNames.indicator}`]: { backgroundColor: tokens.colorNeutralBackgroundDisabled, borderColor: tokens.colorTransparentStrokeDisabled, @@ -245,7 +193,7 @@ const useInputBaseClassName = makeResetStyles({ }, '@media (forced-colors: active)': { - ':disabled': { + ':disabled, &[aria-disabled="true"]': { [`& ~ .${switchClassNames.indicator}`]: { color: 'GrayText', borderColor: 'GrayText', @@ -261,7 +209,7 @@ const useInputBaseClassName = makeResetStyles({ ':hover:active': { color: 'CanvasText', }, - ':enabled:checked': { + ':enabled:checked:not([aria-disabled="true"])': { ':hover': { [`& ~ .${switchClassNames.indicator}`]: { backgroundColor: 'Highlight', @@ -279,44 +227,6 @@ const useInputBaseClassName = makeResetStyles({ color: 'Canvas', }, }, - // DisabledFocusable forced-colors: must come after :enabled:checked to override Highlight styles - // Use :not(:checked) and :checked variants to match the specificity of :enabled:not(:checked) and :enabled:checked - '[aria-disabled="true"]:not(:checked)': { - [`& ~ .${switchClassNames.indicator}`]: { - color: 'GrayText', - borderColor: 'GrayText', - }, - - [`& ~ .${switchClassNames.label}`]: { - color: 'GrayText', - }, - - ':hover, :hover:active': { - [`& ~ .${switchClassNames.indicator}`]: { - color: 'GrayText', - borderColor: 'GrayText', - }, - }, - }, - '[aria-disabled="true"]:checked': { - [`& ~ .${switchClassNames.indicator}`]: { - backgroundColor: 'ButtonFace', - color: 'GrayText', - borderColor: 'GrayText', - }, - - [`& ~ .${switchClassNames.label}`]: { - color: 'GrayText', - }, - - ':hover, :hover:active': { - [`& ~ .${switchClassNames.indicator}`]: { - backgroundColor: 'ButtonFace', - color: 'GrayText', - borderColor: 'GrayText', - }, - }, - }, }, }); From 7b39e287c4fe9a83410d89a6068df28560d9b6ee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 18:11:54 +0000 Subject: [PATCH 4/6] fix(react-switch): refactor disabledFocusable event handling to use onClick/onKeyDown guards Co-authored-by: mainframev <14054752+mainframev@users.noreply.github.com> --- .../library/src/components/Switch/Switch.test.tsx | 9 --------- .../library/src/components/Switch/useSwitch.tsx | 5 ++--- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx b/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx index dd6aec50c2550..2c4e24de4e2eb 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/Switch.test.tsx @@ -167,15 +167,6 @@ describe('Switch', () => { expect(document.activeElement).toEqual(input); }); - it('does not call onChange when disabledFocusable has been passed', () => { - const onChange = jest.fn, SwitchOnChangeData]>(); - const { getByRole } = render(); - const input = getByRole('switch'); - - userEvent.click(input); - expect(onChange).not.toHaveBeenCalled(); - }); - it('calls onChange with the correct value', () => { const onChange = jest.fn, SwitchOnChangeData]>(); const { getByRole } = render(); diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx index df6d94e9f8d15..fdd47124e0ea4 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx @@ -71,11 +71,10 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref { + input.onChange = mergeCallbacks(input.onChange, ev => onChange?.(ev, { checked: ev.currentTarget.checked })); + input.onClick = mergeCallbacks(input.onClick, ev => { if (disabledFocusable) { ev.preventDefault(); - } else { - onChange?.(ev, { checked: ev.currentTarget.checked }); } }); input.onKeyDown = mergeCallbacks(input.onKeyDown, ev => { From 94c90f10296e9b2de0d0559667fa5245e9f033d1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 18:49:51 +0000 Subject: [PATCH 5/6] chore: run nx format on switch files Co-authored-by: mainframev <14054752+mainframev@users.noreply.github.com> --- apps/chart-docsite/.babelrc | 6 +++--- .../testing/fake_node_modules/context-v1.0.0/index.ts | 1 - .../testing/fake_node_modules/context-v1.1.0/index.ts | 1 - .../testing/fake_node_modules/context-v2.0.0/index.ts | 1 - .../fake_node_modules/ignored-context-v1.0.0/index.ts | 1 - .../fake_node_modules/ignored-context-v1.1.0/index.ts | 1 - .../library/src/components/Switch/Switch.types.ts | 3 ++- .../library/src/components/Switch/useSwitch.tsx | 11 +++++++++-- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/chart-docsite/.babelrc b/apps/chart-docsite/.babelrc index b3db474cdefbd..ac08da0a4a36c 100644 --- a/apps/chart-docsite/.babelrc +++ b/apps/chart-docsite/.babelrc @@ -1,3 +1,3 @@ -{ - "extends": "../../babel.config.json" -} +{ + "extends": "../../babel.config.json" +} diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts index 1bbbfff18314d..e124f68f2847e 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts @@ -1,4 +1,3 @@ - import * as React from 'react'; export interface ProviderContextValue { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts index 82752c89b6e71..8929771f513c2 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts @@ -1,4 +1,3 @@ - import { createContext } from 'react'; export interface ProviderContextValue { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts index cdad13827c519..a3507ee85101f 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts @@ -1,4 +1,3 @@ - import * as React from 'react'; export interface ProviderContextValueV2 { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts index db9eaea58d622..757d0845497c9 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts @@ -1,4 +1,3 @@ - import * as React from 'react'; export interface ProviderContextValueV2 { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts index 675fb673d0415..5c1bc655307a0 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts @@ -1,4 +1,3 @@ - import * as React from 'react'; export interface ProviderContextValueV2 { diff --git a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts index 9950b3692c289..fdb43e94a79ff 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts +++ b/packages/react-components/react-switch/library/src/components/Switch/Switch.types.ts @@ -95,7 +95,8 @@ export type SwitchBaseProps = Omit; /** * State used in rendering Switch */ -export type SwitchState = ComponentState & Required>; +export type SwitchState = ComponentState & + Required>; /** * Switch base state, excluding design-related state like size diff --git a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx index fdd47124e0ea4..99bfa74a73228 100644 --- a/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx +++ b/packages/react-components/react-switch/library/src/components/Switch/useSwitch.tsx @@ -38,8 +38,15 @@ export const useSwitchBase_unstable = (props: SwitchBaseProps, ref?: React.Ref, if any props = useFieldControlProps_unstable(props, { supportsLabelFor: true, supportsRequired: true }); - const { checked, defaultChecked, disabled, disabledFocusable = false, labelPosition = 'after', onChange, required } = - props; + const { + checked, + defaultChecked, + disabled, + disabledFocusable = false, + labelPosition = 'after', + onChange, + required, + } = props; const nativeProps = getPartitionedNativeProps({ props, From 22a3bd88706d9faa28e6b335e7f2645741b88344 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 18:55:49 +0000 Subject: [PATCH 6/6] chore: revert format changes outside react-switch package Co-authored-by: mainframev <14054752+mainframev@users.noreply.github.com> --- apps/chart-docsite/.babelrc | 6 +++--- .../src/testing/fake_node_modules/context-v1.0.0/index.ts | 1 + .../src/testing/fake_node_modules/context-v1.1.0/index.ts | 1 + .../src/testing/fake_node_modules/context-v2.0.0/index.ts | 1 + .../fake_node_modules/ignored-context-v1.0.0/index.ts | 1 + .../fake_node_modules/ignored-context-v1.1.0/index.ts | 1 + 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/chart-docsite/.babelrc b/apps/chart-docsite/.babelrc index ac08da0a4a36c..b3db474cdefbd 100644 --- a/apps/chart-docsite/.babelrc +++ b/apps/chart-docsite/.babelrc @@ -1,3 +1,3 @@ -{ - "extends": "../../babel.config.json" -} +{ + "extends": "../../babel.config.json" +} diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts index e124f68f2847e..1bbbfff18314d 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.0.0/index.ts @@ -1,3 +1,4 @@ + import * as React from 'react'; export interface ProviderContextValue { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts index 8929771f513c2..82752c89b6e71 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v1.1.0/index.ts @@ -1,3 +1,4 @@ + import { createContext } from 'react'; export interface ProviderContextValue { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts index a3507ee85101f..cdad13827c519 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/context-v2.0.0/index.ts @@ -1,3 +1,4 @@ + import * as React from 'react'; export interface ProviderContextValueV2 { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts index 757d0845497c9..db9eaea58d622 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.0.0/index.ts @@ -1,3 +1,4 @@ + import * as React from 'react'; export interface ProviderContextValueV2 { diff --git a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts index 5c1bc655307a0..675fb673d0415 100644 --- a/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts +++ b/packages/react-components/babel-preset-global-context/src/testing/fake_node_modules/ignored-context-v1.1.0/index.ts @@ -1,3 +1,4 @@ + import * as React from 'react'; export interface ProviderContextValueV2 {