An open source design system that's fully customizable and agent ready
TypeScript
fix(core): choice controls stay focusable when disabled (#7824)
Cindy Zhang4b0b8f65678c
diff --git a/.changeset/choice-controls-focusable-disabled.md b/.changeset/choice-controls-focusable-disabled.mdnew file mode 100644index 0000000000..cd0f324db9--- /dev/null+++ b/.changeset/choice-controls-focusable-disabled.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Disabled CheckboxInput, CheckboxList items, Switch, Slider and FileInput stay focusable. Before, they rendered the native `disabled` attribute unless a `disabledMessage` was set, so keyboard and screen-reader users could not reach them. Now every disabled control exposes `aria-disabled="true"` and keeps the Tab stop it has when enabled, while toggling, selecting, dragging, opening the file picker and any `onClick` stay blocked, and its value is still left out of form submission. A focused disabled checkbox, switch, slider thumb or file input shows its keyboard focus indicator. This meets the focusable-disabled requirement in spec:AST-085 (FR1–FR3, FR6). No API changes.++@cixzhangdiff --git a/packages/core/src/CheckboxInput/CheckboxInput.test.tsx b/packages/core/src/CheckboxInput/CheckboxInput.test.tsxindex 92a2520114..73b712af8c 100644--- a/packages/core/src/CheckboxInput/CheckboxInput.test.tsx+++ b/packages/core/src/CheckboxInput/CheckboxInput.test.tsx@@ -278,7 +278,7 @@ describe('CheckboxInput', () => {);const checkbox = screen.getByRole('checkbox');expect(checkbox).toBeChecked();- expect(checkbox).toBeDisabled();+ expect(checkbox).toHaveAttribute('aria-disabled', 'true');expect(checkbox).toHaveAttribute('type', 'checkbox');});@@ -588,16 +588,55 @@ describe('CheckboxInput', () => {expect(checkbox).not.toBeChecked();});- it('remains natively disabled when disabled without a reason', () => {+ it('stays focusable via aria-disabled when disabled without a reason', async () => {+ const user = userEvent.setup();+ const onChange = vi.fn();+ const onClick = vi.fn();+ render(+ <form>+ <CheckboxInput+ label="Accept terms"+ value={false}+ onChange={onChange}+ onClick={onClick}+ htmlName="terms"+ isRequired+ isDisabled+ />+ </form>,+ );+ const checkbox = screen.getByRole('checkbox');+ expect(checkbox).not.toHaveAttribute('disabled');+ expect(checkbox).toHaveAttribute('aria-disabled', 'true');+ await user.tab();+ expect(checkbox).toHaveFocus();+ await user.keyboard(' ');+ await user.click(checkbox);+ expect(onChange).not.toHaveBeenCalled();+ expect(onClick).not.toHaveBeenCalled();+ expect(checkbox).not.toBeChecked();+ const form = checkbox.closest('form')!;+ expect(form.checkValidity()).toBe(true);+ expect([...new FormData(form).keys()]).toEqual([]);+ });++ it('keeps a disabled indeterminate checkbox mixed after Space or a click', async () => {+ const user = userEvent.setup();render(<CheckboxInput- label="Accept terms"- value={false}+ label="Select all"+ value="indeterminate"onChange={() => {}}isDisabled/>,);- expect(screen.getByRole('checkbox')).toBeDisabled();+ const checkbox = screen.getByRole<HTMLInputElement>('checkbox');+ expect(checkbox.indeterminate).toBe(true);+ await user.tab();+ await user.keyboard(' ');+ fireEvent.click(checkbox);+ expect(checkbox.indeterminate).toBe(true);+ expect(checkbox).not.toBeChecked();});});describe('form participation', () => {diff --git a/packages/core/src/CheckboxInput/CheckboxInput.tsx b/packages/core/src/CheckboxInput/CheckboxInput.tsxindex 09dc33e86a..0e2f42c0ae 100644--- a/packages/core/src/CheckboxInput/CheckboxInput.tsx+++ b/packages/core/src/CheckboxInput/CheckboxInput.tsx@@ -19,7 +19,6 @@import {useId,useCallback,- use,useOptimistic,useRef,useTransition,@@ -52,7 +51,6 @@ import {usePressFeedback} from '../hooks/usePressFeedback';import {useResolvedRequired} from '../hooks/useResolvedRequired';import {useIndicator} from '../Indicator';import {themeProps} from '../utils/themeProps';-import {CheckboxListContext} from '../CheckboxList/CheckboxListContext';import {useMergedRefs} from '../hooks/useMergedRefs';@@ -354,21 +352,10 @@ export function CheckboxInput({const [optimisticValue, setOptimisticValue] = useOptimistic(value);const isBusy = isLoading || optimisticValue !== value;- // Disabled-reason tooltip. Disabled controls swallow pointer events, so the- // tooltip listeners attach to the checkbox row (which already exists) and the- // native checkbox stays perceivable via aria-disabled instead of the disabled- // attribute. Value mutation is blocked by the isDisabled guard in onChange.+ // A disabled checkbox stays focusable via aria-disabled instead of the+ // native disabled attribute (spec:AST-085 FR1). Value mutation is blocked by+ // the click and onChange guards on the input.const showsDisabledMessage = isDisabled && !!disabledMessage;- // Keep the native checkbox focusable via aria-disabled either when it renders- // its own reason tooltip, or when it sits in a CheckboxList whose whole-group- // `disabledMessage` (shown on the group container) needs each checkbox to- // stay keyboard-perceivable. The group signals this through context rather- // than a public prop.- const checkboxListContext = use(CheckboxListContext);- const isFocusableDisabled =- isDisabled &&- (showsDisabledMessage ||- (checkboxListContext?.hasDisabledMessage ?? false));const disabledMessageTooltip = useTooltip({placement: 'above',// The container row is not naturally focusable; focusin bubbles up from the@@ -384,7 +371,7 @@ export function CheckboxInput({// `opacity: 0`, and only the indicator's own element can shape the outline// to match it. See useIndicatorFocusRing.const indicatorRef = useRef<HTMLSpanElement>(null);- const {focusProps} = useIndicatorFocusRing(indicatorRef, isDisabled);+ const {focusProps} = useIndicatorFocusRing(indicatorRef);const isIndeterminate = optimisticValue === 'indeterminate';const isChecked = optimisticValue === true;@@ -471,22 +458,25 @@ export function CheckboxInput({)}id={id}type="checkbox"- // Withhold the name while disabled: with a disabledMessage the- // input stays focusable (not natively disabled), and a disabled- // control must not submit.+ // Withhold the name while disabled: the input stays focusable (not+ // natively disabled), and a disabled control must not submit.name={isDisabled ? undefined : htmlName}checked={isChecked}- // With a disabledMessage the checkbox keeps focusability via- // aria-disabled so the reason is focus-discoverable; toggling is- // still blocked by the isDisabled guard in onChange below.- disabled={isDisabled && !isFocusableDisabled}- aria-disabled={isFocusableDisabled ? 'true' : undefined}- form={isFocusableDisabled ? '' : undefined}+ aria-disabled={isDisabled ? 'true' : undefined}+ // Detached from its form while disabled, so it neither submits nor+ // blocks submission through `required` (spec:AST-085 FR3).+ form={isDisabled ? '' : undefined}+ // Native `disabled` suppressed onClick (FR2); preventDefault here+ // would desync React's controlled checked state.+ onClick={isDisabled ? undefined : rest.onClick}readOnly={isReadOnly}required={isRequired}aria-required={isEffectivelyRequired ? 'true' : undefined}onChange={e => {if (isDisabled || isBusy || isReadOnly) {+ // Activation clears the native mixed state; React restores+ // only `checked`, so restore `indeterminate` too.+ e.target.indeterminate = isIndeterminate;return;}const checked = e.target.checked;diff --git a/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts b/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.tsindex 35195c0cb7..8eb1c416a9 100644--- a/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts+++ b/packages/core/src/CheckboxInput/__tests__/Checkbox.a11y.states.ts@@ -125,8 +125,8 @@ export const CHECKBOX_BINDING_STATES = [{id: 'input-disabled',binding: 'CheckboxInput',- summary: 'a natively disabled checkbox outside the tab sequence',- facts: facts({operable: false, focusable: false, disabled: true}),+ summary: 'a disabled checkbox that keeps its tab stop',+ facts: facts({operable: false, focusable: true, disabled: true}),visibleLabel: 'Managed setting',storyId: 'a11y-checkbox-pattern--input-disabled',},@@ -269,7 +269,7 @@ export const CHECKBOX_BINDING_STATES = [id: 'list-item-disabled',binding: 'CheckboxListItem',summary: 'an individually disabled list item',- facts: facts({operable: false, focusable: false, disabled: true}),+ facts: facts({operable: false, focusable: true, disabled: true}),visibleLabel: 'SMS',visibleLabelSelector: '[data-a11y-visible-label]',storyId: 'a11y-checkbox-pattern--list-item-disabled',diff --git a/packages/core/src/CheckboxList/CheckboxList.test.tsx b/packages/core/src/CheckboxList/CheckboxList.test.tsxindex 2c68f7e253..0ab47ddbd2 100644--- a/packages/core/src/CheckboxList/CheckboxList.test.tsx+++ b/packages/core/src/CheckboxList/CheckboxList.test.tsx@@ -288,8 +288,9 @@ describe('CheckboxList', () => {</CheckboxList>,);const checkboxes = screen.getAllByRole('checkbox');- expect(checkboxes[0]).toBeDisabled();- expect(checkboxes[1]).toBeDisabled();+ expect(checkboxes[0]).toHaveAttribute('aria-disabled', 'true');+ expect(checkboxes[1]).toHaveAttribute('aria-disabled', 'true');+ expect(checkboxes[0]).not.toHaveAttribute('disabled');});it('does not call onChange when group is disabled', () => {@@ -317,8 +318,9 @@ describe('CheckboxList', () => {</CheckboxList>,);const checkboxes = screen.getAllByRole('checkbox');- expect(checkboxes[0]).not.toBeDisabled();- expect(checkboxes[1]).toBeDisabled();+ expect(checkboxes[0]).not.toHaveAttribute('aria-disabled');+ expect(checkboxes[1]).toHaveAttribute('aria-disabled', 'true');+ expect(checkboxes[1]).not.toHaveAttribute('disabled');});it('throws when item has no value prop inside collection-mode CheckboxList', () => {@@ -1137,7 +1139,7 @@ describe('CheckboxListItem ARIA props', () => {expect(onChange).not.toHaveBeenCalled();});- it('keeps checkboxes natively disabled when disabled without a reason', () => {+ it('keeps checkboxes focusable via aria-disabled when disabled without a reason', () => {render(<CheckboxListlabel="Notifications"@@ -1149,7 +1151,8 @@ describe('CheckboxListItem ARIA props', () => {</CheckboxList>,);for (const checkbox of screen.getAllByRole('checkbox', h)) {- expect(checkbox).toBeDisabled();+ expect(checkbox).not.toHaveAttribute('disabled');+ expect(checkbox).toHaveAttribute('aria-disabled', 'true');}});});diff --git a/packages/core/src/FileInput/FileInput.test.tsx b/packages/core/src/FileInput/FileInput.test.tsxindex 3c1e601871..f817ef3fc3 100644--- a/packages/core/src/FileInput/FileInput.test.tsx+++ b/packages/core/src/FileInput/FileInput.test.tsx@@ -243,12 +243,35 @@ describe('FileInput', () => {expect(trigger).not.toHaveAttribute('aria-required');});- it('sets disabled attribute when isDisabled is true', () => {+ it('keeps a disabled input focusable and out of form submission', async () => {+ const user = userEvent.setup();render(- <FileInput label="Upload" isDisabled value={null} onChange={() => {}} />,+ <form>+ <FileInput+ label="Upload"+ isRequired+ isDisabled+ value={null}+ onChange={() => {}}+ />+ </form>,);- const input = document.querySelector('input[type="file"]')!;- expect(input).toBeDisabled();+ const input =+ document.querySelector<HTMLInputElement>('input[type="file"]')!;+ const trigger = screen.getByRole('button', {name: 'Upload'});+ expect(input).not.toHaveAttribute('disabled');+ expect(trigger).not.toHaveAttribute('disabled');+ expect(trigger).toHaveAttribute('aria-disabled', 'true');+ const openPicker = vi.spyOn(input, 'click');+ await user.tab();+ expect(trigger).toHaveFocus();+ await user.keyboard('{Enter}');+ expect(openPicker).not.toHaveBeenCalled();+ expect(input.form).toBeNull();+ expect(trigger.closest('form')!.checkValidity()).toBe(true);+ // A label click activates the hidden input directly; it is canceled so+ // the picker never opens (fireEvent returns false when prevented).+ expect(fireEvent.click(input)).toBe(false);});it('sets aria-invalid when status type is error', () => {@@ -1095,7 +1118,7 @@ describe('FileInput', () => {expect(clickSpy).not.toHaveBeenCalled();});- it('keeps the trigger non-focusable when disabled without a reason', () => {+ it('keeps the trigger focusable when disabled without a reason', () => {render(<FileInputlabel="Resume"@@ -1105,8 +1128,8 @@ describe('FileInput', () => {/>,);const trigger = screen.getByRole('button');- expect(trigger).toHaveAttribute('tabindex', '-1');- expect(trigger).not.toHaveAttribute('aria-disabled');+ expect(trigger).toHaveAttribute('tabindex', '0');+ expect(trigger).toHaveAttribute('aria-disabled', 'true');});});});diff --git a/packages/core/src/FileInput/FileInput.tsx b/packages/core/src/FileInput/FileInput.tsxindex e2cf3392ca..abfa243934 100644--- a/packages/core/src/FileInput/FileInput.tsx+++ b/packages/core/src/FileInput/FileInput.tsx@@ -179,7 +179,12 @@ const styles = stylex.create({dropzoneDisabled: {cursor: 'default',opacity: 0.5,- borderColor: colorVars['--color-border-emphasized'],+ // Keeps the :focus-within border: a focused disabled trigger still shows+ // focus (spec:AST-085 FR6).+ borderColor: {+ default: colorVars['--color-border-emphasized'],+ ':focus-within': colorVars['--color-accent'],+ },},compact: {boxSizing: 'border-box',@@ -221,7 +226,12 @@ const styles = stylex.create({compactDisabled: {cursor: 'default',opacity: 0.5,- borderColor: colorVars['--color-border-emphasized'],+ // Keeps the :focus-within border: a focused disabled trigger still shows+ // focus (spec:AST-085 FR6).+ borderColor: {+ default: colorVars['--color-border-emphasized'],+ ':focus-within': colorVars['--color-accent'],+ },},hiddenInput: {position: 'absolute',@@ -857,14 +867,9 @@ export function FileInput({<VisuallyHidden><buttontype="button"- // With a disabledMessage the trigger keeps focusability via- // aria-disabled so the reason is focus-discoverable; opening the- // picker is still blocked by the isDisabled guards in the handlers.- // Otherwise the native disabled attribute removes it from the tab- // order.- disabled={isDisabled && !showsDisabledMessage}- tabIndex={isDisabled && !showsDisabledMessage ? -1 : 0}- aria-disabled={showsDisabledMessage ? 'true' : undefined}+ // A disabled trigger keeps its Tab stop (spec:AST-085 FR1).+ tabIndex={0}+ aria-disabled={isDisabled ? 'true' : undefined}onClick={handleClick}onKeyDown={handleKeyDown}// aria-label suppresses child content from the accessible name, so@@ -888,7 +893,12 @@ export function FileInput({type="file"accept={accept}multiple={isMultiple}- disabled={isDisabled}+ // Detached from its form while disabled, so selected files are not+ // submitted and `required` does not block submission (FR3).+ form={isDisabled ? '' : undefined}+ // A label or description click activates this input directly; cancel+ // it so a disabled input never opens the picker (FR2).+ onClick={isDisabled ? event => event.preventDefault() : rest.onClick}onChange={handleInputChange}// The visually-hidden native input is never focused (tabIndex={-1});// its describedby/required/invalid live on the trigger button.diff --git a/packages/core/src/Slider/Slider.test.tsx b/packages/core/src/Slider/Slider.test.tsxindex 961428c78c..9f7c96cee1 100644--- a/packages/core/src/Slider/Slider.test.tsx+++ b/packages/core/src/Slider/Slider.test.tsx@@ -385,7 +385,7 @@ describe('Slider', () => {render(<Slider label="Volume" value={50} isDisabled />);const slider = screen.getByRole('slider');expect(slider).toHaveAttribute('aria-disabled', 'true');- expect(slider).toHaveAttribute('tabIndex', '-1');+ expect(slider).toHaveAttribute('tabIndex', '0');});it('does not fire onChange on pointer down when disabled', () => {@@ -1111,11 +1111,11 @@ describe('Slider', () => {expect(onChange).not.toHaveBeenCalled();});- it('remains non-focusable when disabled without a reason', () => {+ it('stays focusable when disabled without a reason', () => {render(<Slider label="Volume" value={50} valueDisplay="none" isDisabled />,);- expect(screen.getByRole('slider')).toHaveAttribute('tabindex', '-1');+ expect(screen.getByRole('slider')).toHaveAttribute('tabindex', '0');});});describe('form participation', () => {diff --git a/packages/core/src/Slider/Slider.tsx b/packages/core/src/Slider/Slider.tsxindex 7cd2125f4a..65c4a94b71 100644--- a/packages/core/src/Slider/Slider.tsx+++ b/packages/core/src/Slider/Slider.tsx@@ -558,15 +558,12 @@ export function Slider({ref, ...props}: SliderProps) {const handleThumbFocus = useCallback((thumbIndex: number, _e: FocusEvent<HTMLDivElement>) => {- // A disabled thumb draws no ring even when it stays focusable for its- // reason tooltip, so there is nothing to track for one.+ // A focused disabled thumb still shows the ring (spec:AST-085 FR6).setKeyboardFocusThumb(- !isDisabled && getInteractionModality() === 'keyboard'- ? thumbIndex- : null,+ getInteractionModality() === 'keyboard' ? thumbIndex : null,);},- [isDisabled],+ [],);const handleThumbBlur = useCallback((_e: FocusEvent<HTMLDivElement>) => {@@ -960,10 +957,8 @@ export function Slider({ref, ...props}: SliderProps) {ref={!isRange ? ref : undefined}id={!isRange ? id : undefined}role="slider"- // With a disabledMessage the thumb keeps focusability so the reason is- // focus-discoverable; value changes stay blocked by the isDisabled- // guards in the pointer/keyboard handlers.- tabIndex={isDisabled && !showsDisabledMessage ? -1 : 0}+ // A disabled thumb keeps its Tab stop (spec:AST-085 FR1).+ tabIndex={0}aria-valuemin={ariaValueMin}aria-valuemax={ariaValueMax}aria-valuenow={val}@@ -999,8 +994,7 @@ export function Slider({ref, ...props}: SliderProps) {: rtlStyles.centerInline('50%'),!isDisabled && styles.thumbHover,!isDisabled && draggingThumb === thumbIndex && styles.thumbPressed,- !isDisabled &&- keyboardFocusThumb === thumbIndex &&+ keyboardFocusThumb === thumbIndex &&focusOutlineStyles.focusVisible,isDisabled && styles.thumbDisabled,),@@ -1095,7 +1089,9 @@ export function Slider({ref, ...props}: SliderProps) {}),stylex.props(styles.sliderRow),)}>+ {/* A disabled slider submits no value (spec:AST-085 FR3). */}{htmlName != null &&+ !isDisabled &&values.map((v, i) => (<input// Positional identity: index 0 is the start thumb, 1 the end.@@ -1103,9 +1099,6 @@ export function Slider({ref, ...props}: SliderProps) {type="hidden"name={htmlName}value={String(v)}- // Disabled native controls are excluded from form submission;- // mirror that for the hidden carrier.- disabled={isDisabled}/>))}<divdiff --git a/packages/core/src/Switch/Switch.test.tsx b/packages/core/src/Switch/Switch.test.tsxindex a7d2e66d27..1357e369b3 100644--- a/packages/core/src/Switch/Switch.test.tsx+++ b/packages/core/src/Switch/Switch.test.tsx@@ -624,16 +624,37 @@ describe('Switch', () => {expect(onChange).not.toHaveBeenCalled();});- it('remains natively disabled when disabled without a reason', () => {+ it('stays focusable via aria-disabled when disabled without a reason', async () => {+ const user = userEvent.setup();+ const onChange = vi.fn();+ const onClick = vi.fn();render(- <Switch- label="Enable notifications"- value={false}- onChange={() => {}}- isDisabled- />,+ <form>+ <Switch+ label="Enable notifications"+ value={false}+ onChange={onChange}+ onClick={onClick}+ htmlName="notifications"+ isRequired+ isDisabled+ />+ </form>,);- expect(screen.getByRole('switch')).toBeDisabled();+ const control = screen.getByRole('switch');+ expect(control).not.toHaveAttribute('disabled');+ expect(control).toHaveAttribute('aria-disabled', 'true');+ await user.tab();+ expect(control).toHaveFocus();+ await user.keyboard(' ');+ await user.click(control);+ await user.click(screen.getByText('Enable notifications'));+ expect(onChange).not.toHaveBeenCalled();+ expect(onClick).not.toHaveBeenCalled();+ expect(control).not.toBeChecked();+ const form = control.closest('form')!;+ expect(form.checkValidity()).toBe(true);+ expect([...new FormData(form).keys()]).toEqual([]);});});describe('labelSpacing', () => {diff --git a/packages/core/src/Switch/Switch.tsx b/packages/core/src/Switch/Switch.tsxindex ad71d0c2e5..186e01062a 100644--- a/packages/core/src/Switch/Switch.tsx+++ b/packages/core/src/Switch/Switch.tsx@@ -43,7 +43,7 @@ import type {InputStatus} from '../Field/types';import {Spinner} from '../Spinner';import {useTooltip} from '../Tooltip';import {mergeProps, mergeRefs, rtlStyles} from '../utils';-import {switchScope} from './switch.markers.stylex';+import {switchFocusScope, switchScope} from './switch.markers.stylex';import {interactionOverlayStyles} from '../utils/interactionOverlay.stylex';import type {BaseProps} from '../BaseProps';import type {SizeValue} from '../utils/types';@@ -265,12 +265,12 @@ const styles = stylex.create({trackFocus: {outline: {default: 'none',- [stylex.when.ancestor(':has(:focus-visible)', switchScope)]:+ [stylex.when.ancestor(':has(:focus-visible)', switchFocusScope)]:`${focusVars['--focus-outline-width']} ${focusVars['--focus-outline-style']} ${focusVars['--focus-outline-color']}`,},outlineOffset: {default: null,- [stylex.when.ancestor(':has(:focus-visible)', switchScope)]:+ [stylex.when.ancestor(':has(:focus-visible)', switchFocusScope)]:focusVars['--focus-outline-offset'],},},@@ -637,17 +637,13 @@ export function Switch({id={id}type="checkbox"role="switch"- // Withhold the name while disabled: with a disabledMessage the- // input stays focusable (not natively disabled), and a disabled- // control must not submit.+ // Withhold the name while disabled: the input stays focusable (not+ // natively disabled), and a disabled control must not submit.name={isDisabled ? undefined : htmlName}checked={isOn}- // With a disabledMessage the switch keeps focusability via aria-disabled- // so the reason is focus-discoverable; toggling is still blocked by the- // isDisabled guard in onChange below.- disabled={isDisabled && !showsDisabledMessage}- aria-disabled={showsDisabledMessage ? 'true' : undefined}- form={showsDisabledMessage ? '' : undefined}+ // Focusable but detached from the form while disabled (spec:AST-085).+ aria-disabled={isDisabled ? 'true' : undefined}+ form={isDisabled ? '' : undefined}required={isRequired}aria-required={isEffectivelyRequired ? 'true' : undefined}onChange={e => {@@ -693,7 +689,7 @@ export function Switch({styles.track,trackSizeStyles[size],isOn ? styles.trackOn : styles.trackOff,- !isDisabled && styles.trackFocus,+ styles.trackFocus,isDisabled && styles.trackDisabled,isDisabled && !isOn && styles.trackDisabledOff,),@@ -747,7 +743,9 @@ export function Switch({className,style,)}- {...rest}>+ {...rest}+ // Native `disabled` suppressed clicks on the switch (spec:AST-085 FR2).+ onClick={isDisabled ? undefined : rest.onClick}><divref={el => {// Interaction (hover/focus) listeners for the disabled-message@@ -764,6 +762,7 @@ export function Switch({isLabelHidden && styles.containerLabelHidden,labelSpacing === 'spread' && styles.containerSpread,!isDisabled && switchScope,+ switchFocusScope,// The touch press's strength and release live on the row the// controller writes to; the track and thumb inherit and paint it.!isDisabled && interactionOverlayStyles.pressedAlpha,diff --git a/packages/core/src/Switch/__tests__/Switch.a11y.states.ts b/packages/core/src/Switch/__tests__/Switch.a11y.states.tsindex e226e40df3..051ddac6aa 100644--- a/packages/core/src/Switch/__tests__/Switch.a11y.states.ts+++ b/packages/core/src/Switch/__tests__/Switch.a11y.states.ts@@ -147,7 +147,7 @@ export const SWITCH_BINDING_STATES: ReadonlyArray<SwitchBindingState> = [},{id: 'disabled',- summary: 'a natively disabled switch, out of the tab sequence',+ summary: 'a disabled switch that keeps its tab stop',storyId: 'core-switch--disabled',visibleLabel: 'Premium feature',props: {@@ -159,7 +159,7 @@ export const SWITCH_BINDING_STATES: ReadonlyArray<SwitchBindingState> = [facts: {checked: false,operable: false,- focusable: false,+ focusable: true,disabled: true,described: true,required: false,diff --git a/packages/core/src/Switch/switch.markers.stylex.ts b/packages/core/src/Switch/switch.markers.stylex.tsindex a142eb8300..e8a4634723 100644--- a/packages/core/src/Switch/switch.markers.stylex.ts+++ b/packages/core/src/Switch/switch.markers.stylex.ts@@ -8,3 +8,7 @@ import * as stylex from '@stylexjs/stylex';*/export const switchScope: ReturnType<typeof stylex.defineMarker> =stylex.defineMarker();++/** Focus-ring marker; unlike `switchScope`, it stays on while disabled. */+export const switchFocusScope: ReturnType<typeof stylex.defineMarker> =+ stylex.defineMarker();diff --git a/packages/core/src/Table/plugins/selection/useTableSelection.test.tsx b/packages/core/src/Table/plugins/selection/useTableSelection.test.tsxindex a34fa3c4d2..8f7f90a261 100644--- a/packages/core/src/Table/plugins/selection/useTableSelection.test.tsx+++ b/packages/core/src/Table/plugins/selection/useTableSelection.test.tsx@@ -195,9 +195,11 @@ describe('useTableSelection', () => {it('disables checkbox for disabled rows', () => {render(<SelectionTable getIsItemEnabled={item => !item.isLocked} />);const rowCheckboxes = screen.getAllByLabelText('Select row');- expect(rowCheckboxes[0]).not.toBeDisabled();- expect(rowCheckboxes[1]).not.toBeDisabled();- expect(rowCheckboxes[2]).toBeDisabled();+ expect(rowCheckboxes[0]).not.toHaveAttribute('aria-disabled');+ expect(rowCheckboxes[1]).not.toHaveAttribute('aria-disabled');+ // Focusable disabled (spec:AST-085 FR1): aria-disabled, no native disabled.+ expect(rowCheckboxes[2]).toHaveAttribute('aria-disabled', 'true');+ expect(rowCheckboxes[2]).not.toHaveAttribute('disabled');});it('prepends selection <td> to each body row', () => {