Skip to content

Commit 9dcbb26

Browse files
authored
refactor(multiple): rename skipDisabled to softDisabled (#32187)
The skipDisabled input is renamed to softDisabled to better align with accessibility best practices.
1 parent b4652eb commit 9dcbb26

File tree

70 files changed

+322
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+322
-322
lines changed

src/aria/accordion/accordion.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('AccordionGroup', () => {
3636
multiExpandable?: boolean;
3737
disabledGroup?: boolean;
3838
disabledItemValues?: string[];
39-
skipDisabled?: boolean;
39+
softDisabled?: boolean;
4040
wrap?: boolean;
4141
}
4242

@@ -52,8 +52,8 @@ describe('AccordionGroup', () => {
5252
if (opts.disabledGroup !== undefined) {
5353
testComponent.disabledGroup.set(opts.disabledGroup);
5454
}
55-
if (opts.skipDisabled !== undefined) {
56-
testComponent.skipDisabled.set(opts.skipDisabled);
55+
if (opts.softDisabled !== undefined) {
56+
testComponent.softDisabled.set(opts.softDisabled);
5757
}
5858
if (opts.wrap !== undefined) {
5959
testComponent.wrap.set(opts.wrap);
@@ -342,17 +342,17 @@ describe('AccordionGroup', () => {
342342
});
343343
});
344344

345-
describe('skipDisabled behavior', () => {
346-
it('should skip disabled items if skipDisabled=true', () => {
347-
configureAccordionComponent({skipDisabled: true, disabledItemValues: ['item-2']});
345+
describe('softDisabled behavior', () => {
346+
it('should skip disabled items if softDisabled=false', () => {
347+
configureAccordionComponent({softDisabled: false, disabledItemValues: ['item-2']});
348348

349349
expect(isTriggerActive(triggerElements[0])).toBeTrue();
350350
downArrowKey(triggerElements[0]);
351351
expect(isTriggerActive(triggerElements[2])).toBeTrue();
352352
});
353353

354-
it('should focus disabled items if skipDisabled=false', () => {
355-
configureAccordionComponent({skipDisabled: false, disabledItemValues: ['item-2']});
354+
it('should focus disabled items if softDisabled=true', () => {
355+
configureAccordionComponent({softDisabled: true, disabledItemValues: ['item-2']});
356356

357357
expect(isTriggerActive(triggerElements[0])).toBeTrue();
358358
downArrowKey(triggerElements[0]);
@@ -385,7 +385,7 @@ describe('AccordionGroup', () => {
385385
[(value)]="value"
386386
[multiExpandable]="multiExpandable()"
387387
[disabled]="disabledGroup()"
388-
[skipDisabled]="skipDisabled()"
388+
[softDisabled]="softDisabled()"
389389
[wrap]="wrap()"
390390
>
391391
@for (item of items(); track item.value) {
@@ -419,7 +419,7 @@ class AccordionGroupExample {
419419
value = model<string[]>([]);
420420
multiExpandable = signal(false);
421421
disabledGroup = signal(false);
422-
skipDisabled = signal(true);
422+
softDisabled = signal(false);
423423
wrap = signal(false);
424424

425425
disableItem(itemValue: string, disabled: boolean) {

src/aria/accordion/accordion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export class AccordionGroup {
170170
/** The values of the current selected/expanded accordions. */
171171
value = model<string[]>([]);
172172

173-
/** Whether disabled items should be skipped during keyboard navigation. */
174-
skipDisabled = input(true, {transform: booleanAttribute});
173+
/** Whether to allow disabled items to receive focus. */
174+
softDisabled = input(false, {transform: booleanAttribute});
175175

176176
/** Whether keyboard navigation should wrap around from the last item to the first, and vice-versa. */
177177
wrap = input(false, {transform: booleanAttribute});

src/aria/grid/grid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export class Grid {
6565
/** Whether the grid is disabled. */
6666
readonly disabled = input(false, {transform: booleanAttribute});
6767

68-
/** Whether to skip disabled items during navigation. */
69-
readonly skipDisabled = input(true, {transform: booleanAttribute});
68+
/** Whether to allow disabled items to receive focus. */
69+
readonly softDisabled = input(false, {transform: booleanAttribute});
7070

7171
/** The focus strategy used by the grid. */
7272
readonly focusMode = input<'roving' | 'activedescendant'>('roving');

src/aria/listbox/listbox.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('Listbox', () => {
5353
disabled?: boolean;
5454
readonly?: boolean;
5555
value?: number[];
56-
skipDisabled?: boolean;
56+
softDisabled?: boolean;
5757
focusMode?: 'roving' | 'activedescendant';
5858
multi?: boolean;
5959
wrap?: boolean;
@@ -74,7 +74,7 @@ describe('Listbox', () => {
7474
if (opts?.disabled !== undefined) testComponent.disabled = opts.disabled;
7575
if (opts?.readonly !== undefined) testComponent.readonly = opts.readonly;
7676
if (opts?.value !== undefined) testComponent.value = opts.value;
77-
if (opts?.skipDisabled !== undefined) testComponent.skipDisabled = opts.skipDisabled;
77+
if (opts?.softDisabled !== undefined) testComponent.softDisabled = opts.softDisabled;
7878
if (opts?.focusMode !== undefined) testComponent.focusMode = opts.focusMode;
7979
if (opts?.multi !== undefined) testComponent.multi = opts.multi;
8080
if (opts?.wrap !== undefined) testComponent.wrap = opts.wrap;
@@ -593,22 +593,22 @@ describe('Listbox', () => {
593593
expect(isFocused(1)).toBe(true);
594594
});
595595

596-
it('should skip disabled options with ArrowDown (skipDisabled="true")', () => {
596+
it('should skip disabled options with ArrowDown (softDisabled="false")', () => {
597597
setupListbox({
598598
focusMode,
599599
orientation: 'vertical',
600-
skipDisabled: true,
600+
softDisabled: false,
601601
disabledOptions: [1, 2],
602602
});
603603
down();
604604
expect(isFocused(3)).toBe(true);
605605
});
606606

607-
it('should not skip disabled options with ArrowDown (skipDisabled="false")', () => {
607+
it('should not skip disabled options with ArrowDown (softDisabled="true")', () => {
608608
setupListbox({
609609
focusMode,
610610
orientation: 'vertical',
611-
skipDisabled: false,
611+
softDisabled: true,
612612
disabledOptions: [1, 2],
613613
});
614614
down();
@@ -641,7 +641,7 @@ describe('Listbox', () => {
641641
});
642642

643643
it('should move focus to the clicked disabled option', () => {
644-
setupListbox({focusMode, disabledOptions: [2], skipDisabled: false});
644+
setupListbox({focusMode, disabledOptions: [2], softDisabled: true});
645645
click(2);
646646
expect(isFocused(2)).toBe(true);
647647
});
@@ -696,14 +696,14 @@ describe('Listbox', () => {
696696
expect(isFocused(0)).toBe(true);
697697
}));
698698

699-
it('should skip disabled options with typeahead (skipDisabled=true)', () => {
700-
setupListbox({options: getOptions(), focusMode, disabledOptions: [2], skipDisabled: true});
699+
it('should skip disabled options with typeahead (softDisabled=false)', () => {
700+
setupListbox({options: getOptions(), focusMode, disabledOptions: [2], softDisabled: false});
701701
type('B');
702702
expect(isFocused(3)).toBe(true);
703703
});
704704

705-
it('should focus disabled options with typeahead if skipDisabled=false', () => {
706-
setupListbox({options: getOptions(), focusMode, disabledOptions: [2], skipDisabled: false});
705+
it('should focus disabled options with typeahead if softDisabled=true', () => {
706+
setupListbox({options: getOptions(), focusMode, disabledOptions: [2], softDisabled: true});
707707
type('B');
708708
expect(isFocused(2)).toBe(true);
709709
});
@@ -749,7 +749,7 @@ interface TestOption {
749749
[readonly]="readonly"
750750
[focusMode]="focusMode"
751751
[orientation]="orientation"
752-
[skipDisabled]="skipDisabled"
752+
[softDisabled]="softDisabled"
753753
[multi]="multi"
754754
[wrap]="wrap"
755755
[selectionMode]="selectionMode"
@@ -773,7 +773,7 @@ class ListboxExample {
773773
value: number[] = [];
774774
disabled = false;
775775
readonly = false;
776-
skipDisabled = true;
776+
softDisabled = false;
777777
focusMode: 'roving' | 'activedescendant' = 'roving';
778778
orientation: 'vertical' | 'horizontal' = 'vertical';
779779
multi = false;

src/aria/listbox/listbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ export class Listbox<V> {
9797
/** Whether focus should wrap when navigating. */
9898
wrap = input(true, {transform: booleanAttribute});
9999

100-
/** Whether disabled items in the list should be skipped when navigating. */
101-
skipDisabled = input(true, {transform: booleanAttribute});
100+
/** Whether to allow disabled items in the list to receive focus. */
101+
softDisabled = input(false, {transform: booleanAttribute});
102102

103103
/** The focus strategy used by the list. */
104104
focusMode = input<'roving' | 'activedescendant'>('roving');

src/aria/menu/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class Menu<V> {
184184
...this,
185185
parent: computed(() => this.parent()?._pattern),
186186
multi: () => false,
187-
skipDisabled: () => false,
187+
softDisabled: () => true,
188188
focusMode: () => 'roving',
189189
orientation: () => 'vertical',
190190
selectionMode: () => 'explicit',
@@ -306,7 +306,7 @@ export class MenuBar<V> {
306306
this._pattern = new MenuBarPattern({
307307
...this,
308308
multi: () => false,
309-
skipDisabled: () => false,
309+
softDisabled: () => true,
310310
focusMode: () => 'roving',
311311
orientation: () => 'horizontal',
312312
selectionMode: () => 'explicit',

src/aria/private/accordion/accordion.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('Accordion Pattern', () => {
6666
multiExpandable: signal(true),
6767
items: signal([]),
6868
expandedIds: signal<string[]>([]),
69-
skipDisabled: signal(true),
69+
softDisabled: signal(false),
7070
wrap: signal(true),
7171
element: signal(document.createElement('div')),
7272
};

src/aria/private/accordion/accordion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class AccordionGroupPattern {
5353
this.multiExpandable = inputs.multiExpandable;
5454
this.items = inputs.items;
5555
this.expandedIds = inputs.expandedIds;
56-
this.skipDisabled = inputs.skipDisabled;
56+
this.softDisabled = inputs.softDisabled;
5757
this.focusManager = new ListFocus({
5858
...inputs,
5959
focusMode,

src/aria/private/behaviors/grid-focus/grid-focus.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ export function setupGridFocus(inputs: TestSetupInputs = {}): {
7575
inputs.focusMode ? inputs.focusMode() : 'roving',
7676
);
7777
const disabled = signal(inputs.disabled ? inputs.disabled() : false);
78-
const skipDisabled = signal(inputs.skipDisabled ? inputs.skipDisabled() : true);
78+
const softDisabled = signal(inputs.softDisabled ? inputs.softDisabled() : false);
7979

8080
gridFocus.set(
8181
new GridFocus<TestGridCell>({
8282
cells: cells,
8383
activeCoords: activeCoords,
8484
focusMode: focusMode,
8585
disabled: disabled,
86-
skipDisabled: skipDisabled,
86+
softDisabled: softDisabled,
8787
}),
8888
);
8989

@@ -292,23 +292,23 @@ describe('GridFocus', () => {
292292
expect(gridFocus.isFocusable(cells[0][2])).toBeTrue();
293293
});
294294

295-
it('should return false if cell is disabled and skipDisabled is true', () => {
295+
it('should return false if cell is disabled and softDisabled is false', () => {
296296
const {gridFocus, cells} = setupGridFocus({
297297
numRows: 1,
298298
numCols: 3,
299-
skipDisabled: signal(true),
299+
softDisabled: signal(false),
300300
});
301301
cells[0][1].disabled.set(true);
302302
expect(gridFocus.isFocusable(cells[0][0])).toBeTrue();
303303
expect(gridFocus.isFocusable(cells[0][1])).toBeFalse();
304304
expect(gridFocus.isFocusable(cells[0][2])).toBeTrue();
305305
});
306306

307-
it('should return true if cell is disabled but skipDisabled is false', () => {
307+
it('should return true if cell is disabled but softDisabled is true', () => {
308308
const {gridFocus, cells} = setupGridFocus({
309309
numRows: 1,
310310
numCols: 3,
311-
skipDisabled: signal(false),
311+
softDisabled: signal(true),
312312
});
313313
cells[0][1].disabled.set(true);
314314
expect(gridFocus.isFocusable(cells[0][0])).toBeTrue();

src/aria/private/behaviors/grid-focus/grid-focus.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export interface GridFocusInputs<T extends GridFocusCell> {
4747
/** The coordinates (row and column) of the current active cell. */
4848
activeCoords: WritableSignalLike<RowCol>;
4949

50-
/** Whether disabled cells in the grid should be skipped when navigating. */
51-
skipDisabled: SignalLike<boolean>;
50+
/** Whether disabled cells in the grid should be focusable. */
51+
softDisabled: SignalLike<boolean>;
5252
}
5353

5454
/** Represents coordinates in a grid. */
@@ -163,7 +163,7 @@ export class GridFocus<T extends GridFocusCell> {
163163

164164
/** Returns true if the given cell can be navigated to. */
165165
isFocusable(cell: T): boolean {
166-
return !cell.disabled() || !this.inputs.skipDisabled();
166+
return !cell.disabled() || this.inputs.softDisabled();
167167
}
168168

169169
/** Finds the top-left anchor coordinates of a given cell instance in the grid. */

0 commit comments

Comments
 (0)