Skip to content

Commit c27feea

Browse files
committed
refactor(multiple): use camelCase for activeDescendant and tabIndex in angular/aria
1 parent 28a50f5 commit c27feea

File tree

32 files changed

+128
-128
lines changed

32 files changed

+128
-128
lines changed

src/aria/accordion/accordion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class AccordionPanel {
9595
'[attr.aria-controls]': '_pattern.controls()',
9696
'[attr.aria-disabled]': '_pattern.disabled()',
9797
'[attr.disabled]': 'hardDisabled() ? true : null',
98-
'[attr.tabindex]': '_pattern.tabindex()',
98+
'[attr.tabindex]': '_pattern.tabIndex()',
9999
'(keydown)': '_pattern.onKeydown($event)',
100100
'(pointerdown)': '_pattern.onPointerdown($event)',
101101
'(focusin)': '_pattern.onFocus($event)',
@@ -122,7 +122,7 @@ export class AccordionTrigger {
122122
*
123123
* TODO(ok7sai): Consider move this to UI patterns.
124124
*/
125-
readonly hardDisabled = computed(() => this._pattern.disabled() && this._pattern.tabindex() < 0);
125+
readonly hardDisabled = computed(() => this._pattern.disabled() && this._pattern.tabIndex() < 0);
126126

127127
/** The accordion panel pattern controlled by this trigger. This is set by AccordionGroup. */
128128
readonly accordionPanel: WritableSignal<AccordionPanelPattern | undefined> = signal(undefined);

src/aria/combobox/combobox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class Combobox<V> {
123123
'role': 'combobox',
124124
'[value]': 'value()',
125125
'[attr.aria-expanded]': 'combobox._pattern.expanded()',
126-
'[attr.aria-activedescendant]': 'combobox._pattern.activedescendant()',
126+
'[attr.aria-activedescendant]': 'combobox._pattern.activeDescendant()',
127127
'[attr.aria-controls]': 'combobox._pattern.popupId()',
128128
'[attr.aria-haspopup]': 'combobox._pattern.hasPopup()',
129129
'[attr.aria-autocomplete]': 'combobox._pattern.autocomplete()',

src/aria/listbox/listbox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ import {ComboboxPopup} from '../combobox';
4646
'role': 'listbox',
4747
'class': 'ng-listbox',
4848
'[attr.id]': 'id()',
49-
'[attr.tabindex]': '_pattern.tabindex()',
49+
'[attr.tabindex]': '_pattern.tabIndex()',
5050
'[attr.aria-readonly]': '_pattern.readonly()',
5151
'[attr.aria-disabled]': '_pattern.disabled()',
5252
'[attr.aria-orientation]': '_pattern.orientation()',
5353
'[attr.aria-multiselectable]': '_pattern.multi()',
54-
'[attr.aria-activedescendant]': '_pattern.activedescendant()',
54+
'[attr.aria-activedescendant]': '_pattern.activeDescendant()',
5555
'(keydown)': '_pattern.onKeydown($event)',
5656
'(pointerdown)': '_pattern.onPointerdown($event)',
5757
'(focusin)': 'onFocus()',
@@ -198,7 +198,7 @@ export class Listbox<V> {
198198
'class': 'ng-option',
199199
'[attr.data-active]': '_pattern.active()',
200200
'[attr.id]': '_pattern.id()',
201-
'[attr.tabindex]': '_pattern.tabindex()',
201+
'[attr.tabindex]': '_pattern.tabIndex()',
202202
'[attr.aria-selected]': '_pattern.selected()',
203203
'[attr.aria-disabled]': '_pattern.disabled()',
204204
},

src/aria/menu/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {Directionality} from '@angular/cdk/bidi';
4545
exportAs: 'ngMenuTrigger',
4646
host: {
4747
'class': 'ng-menu-trigger',
48-
'[attr.tabindex]': '_pattern.tabindex()',
48+
'[attr.tabindex]': '_pattern.tabIndex()',
4949
'[attr.aria-haspopup]': '_pattern.hasPopup()',
5050
'[attr.aria-expanded]': '_pattern.expanded()',
5151
'[attr.aria-controls]': '_pattern.menu()?.id()',
@@ -340,7 +340,7 @@ export class MenuBar<V> {
340340
'role': 'menuitem',
341341
'class': 'ng-menu-item',
342342
'(focusin)': 'onFocusIn()',
343-
'[attr.tabindex]': '_pattern.tabindex()',
343+
'[attr.tabindex]': '_pattern.tabIndex()',
344344
'[attr.data-active]': '_pattern.isActive()',
345345
'[attr.aria-haspopup]': '_pattern.hasPopup()',
346346
'[attr.aria-expanded]': '_pattern.expanded()',

src/aria/private/accordion/accordion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export class AccordionTriggerPattern {
103103
/** Id of the accordion panel controlled by the trigger. */
104104
controls = computed(() => this.inputs.accordionPanel()?.id());
105105

106-
/** The tabindex of the trigger. */
107-
tabindex = computed(() => (this.inputs.accordionGroup().focusManager.isFocusable(this) ? 0 : -1));
106+
/** The tab index of the trigger. */
107+
tabIndex = computed(() => (this.inputs.accordionGroup().focusManager.isFocusable(this) ? 0 : -1));
108108

109109
/** Whether the trigger is disabled. Disabling an accordion group disables all the triggers. */
110110
disabled = computed(() => this.inputs.disabled() || this.inputs.accordionGroup().disabled());

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,17 @@ describe('GridFocus', () => {
231231
describe('getGridTabindex', () => {
232232
it('should return 0 if grid is disabled', () => {
233233
const {gridFocus} = setupGridFocus({disabled: signal(true)});
234-
expect(gridFocus.getGridTabindex()).toBe(0);
234+
expect(gridFocus.getGridTabIndex()).toBe(0);
235235
});
236236

237237
it('should return -1 if focusMode is "roving" and grid is not disabled', () => {
238238
const {gridFocus} = setupGridFocus({focusMode: signal('roving')});
239-
expect(gridFocus.getGridTabindex()).toBe(-1);
239+
expect(gridFocus.getGridTabIndex()).toBe(-1);
240240
});
241241

242242
it('should return 0 if focusMode is "activedescendant" and grid is not disabled', () => {
243243
const {gridFocus} = setupGridFocus({focusMode: signal('activedescendant')});
244-
expect(gridFocus.getGridTabindex()).toBe(0);
244+
expect(gridFocus.getGridTabIndex()).toBe(0);
245245
});
246246
});
247247

@@ -252,9 +252,9 @@ describe('GridFocus', () => {
252252
numCols: 3,
253253
disabled: signal(true),
254254
});
255-
expect(gridFocus.getCellTabindex(cells[0][0])).toBe(-1);
256-
expect(gridFocus.getCellTabindex(cells[0][1])).toBe(-1);
257-
expect(gridFocus.getCellTabindex(cells[0][2])).toBe(-1);
255+
expect(gridFocus.getCellTabIndex(cells[0][0])).toBe(-1);
256+
expect(gridFocus.getCellTabIndex(cells[0][1])).toBe(-1);
257+
expect(gridFocus.getCellTabIndex(cells[0][2])).toBe(-1);
258258
});
259259

260260
it('should return -1 if focusMode is "activedescendant"', () => {
@@ -263,9 +263,9 @@ describe('GridFocus', () => {
263263
numCols: 3,
264264
focusMode: signal('activedescendant'),
265265
});
266-
expect(gridFocus.getCellTabindex(cells[0][0])).toBe(-1);
267-
expect(gridFocus.getCellTabindex(cells[0][1])).toBe(-1);
268-
expect(gridFocus.getCellTabindex(cells[0][2])).toBe(-1);
266+
expect(gridFocus.getCellTabIndex(cells[0][0])).toBe(-1);
267+
expect(gridFocus.getCellTabIndex(cells[0][1])).toBe(-1);
268+
expect(gridFocus.getCellTabIndex(cells[0][2])).toBe(-1);
269269
});
270270

271271
it('should return 0 if focusMode is "roving" and cell is the activeCell', () => {
@@ -275,9 +275,9 @@ describe('GridFocus', () => {
275275
focusMode: signal('roving'),
276276
});
277277

278-
expect(gridFocus.getCellTabindex(cells[0][0])).toBe(0);
279-
expect(gridFocus.getCellTabindex(cells[0][1])).toBe(-1);
280-
expect(gridFocus.getCellTabindex(cells[0][2])).toBe(-1);
278+
expect(gridFocus.getCellTabIndex(cells[0][0])).toBe(0);
279+
expect(gridFocus.getCellTabIndex(cells[0][1])).toBe(-1);
280+
expect(gridFocus.getCellTabIndex(cells[0][2])).toBe(-1);
281281
});
282282
});
283283

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ export class GridFocus<T extends GridFocusCell> {
9696
return gridCells.length === 0 || gridCells.every(row => row.every(cell => cell.disabled()));
9797
}
9898

99-
/** The tabindex for the grid container. */
100-
getGridTabindex(): -1 | 0 {
99+
/** The tab index for the grid container. */
100+
getGridTabIndex(): -1 | 0 {
101101
if (this.isGridDisabled()) {
102102
return 0;
103103
}
104104
return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;
105105
}
106106

107-
/** Returns the tabindex for the given grid cell cell. */
108-
getCellTabindex(cell: T): -1 | 0 {
107+
/** Returns the tab index for the given grid cell cell. */
108+
getCellTabIndex(cell: T): -1 | 0 {
109109
if (this.isGridDisabled()) {
110110
return -1;
111111
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ describe('GridFocus', () => {
220220

221221
gridFocus.focusCell(cells[1][1]);
222222

223-
expect(gridFocus.getCellTabindex(cells[1][1])).toBe(0);
223+
expect(gridFocus.getCellTabIndex(cells[1][1])).toBe(0);
224224
});
225225

226226
it('should return -1 for inactive cells in roving mode', () => {
@@ -231,8 +231,8 @@ describe('GridFocus', () => {
231231

232232
gridFocus.focusCell(cells[1][1]);
233233

234-
expect(gridFocus.getCellTabindex(cells[0][0])).toBe(-1);
235-
expect(gridFocus.getCellTabindex(cells[2][2])).toBe(-1);
234+
expect(gridFocus.getCellTabIndex(cells[0][0])).toBe(-1);
235+
expect(gridFocus.getCellTabIndex(cells[2][2])).toBe(-1);
236236
});
237237

238238
it('should return -1 for all cells in activedescendant mode', () => {
@@ -243,14 +243,14 @@ describe('GridFocus', () => {
243243

244244
gridFocus.focusCell(cells[1][1]);
245245

246-
expect(gridFocus.getCellTabindex(cells[0][0])).toBe(-1);
247-
expect(gridFocus.getCellTabindex(cells[1][1])).toBe(-1);
246+
expect(gridFocus.getCellTabIndex(cells[0][0])).toBe(-1);
247+
expect(gridFocus.getCellTabIndex(cells[1][1])).toBe(-1);
248248
});
249249

250250
it('should return -1 for all cells when the grid is disabled', () => {
251251
const cells = createTestGrid(createGridA);
252252
const gridFocus = setupGridFocus(signal(cells), {disabled: signal(true)});
253-
expect(gridFocus.getCellTabindex(cells[1][1])).toBe(-1);
253+
expect(gridFocus.getCellTabIndex(cells[1][1])).toBe(-1);
254254
});
255255
});
256256

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class GridFocus<T extends GridFocusCell> {
9595
return gridCells.length === 0 || gridCells.every(row => row.every(cell => cell.disabled()));
9696
});
9797

98-
/** The tabindex for the grid container. */
98+
/** The tab index for the grid container. */
9999
readonly gridTabIndex = computed<-1 | 0>(() => {
100100
if (this.gridDisabled()) {
101101
return 0;
@@ -105,8 +105,8 @@ export class GridFocus<T extends GridFocusCell> {
105105

106106
constructor(readonly inputs: GridFocusInputs & GridFocusDeps<T>) {}
107107

108-
/** Returns the tabindex for the given grid cell cell. */
109-
getCellTabindex(cell: T): -1 | 0 {
108+
/** Returns the tab index for the given grid cell cell. */
109+
getCellTabIndex(cell: T): -1 | 0 {
110110
if (this.gridDisabled()) {
111111
return -1;
112112
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('Grid', () => {
7474
});
7575

7676
describe('cellTabIndex', () => {
77-
it('should return the tabindex for a cell', () => {
77+
it('should return the tab index for a cell', () => {
7878
const cells = createTestGrid(createGridA);
7979
const grid = setupGrid(signal(cells));
8080

0 commit comments

Comments
 (0)