Skip to content

Commit cdc9582

Browse files
committed
refactor(multiple): avoid focusing list element in activedescendant mode
1 parent f449563 commit cdc9582

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ describe('List Focus', () => {
100100
expect(focusManager.getActiveDescendant()).toBe(focusManager.inputs.items()[1].id());
101101
});
102102

103-
it('should focus the list element when focusing an item', () => {
103+
it('should NOT focus the list element when focusing an item', () => {
104104
const focusSpy = spyOn(focusManager.inputs.element()!, 'focus');
105105
focusManager.focus(focusManager.inputs.items()[1]);
106-
expect(focusSpy).toHaveBeenCalled();
106+
expect(focusSpy).not.toHaveBeenCalled();
107107
});
108108
});
109109

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ export class ListFocus<T extends ListFocusItem> {
105105
if (opts?.focusElement || opts?.focusElement === undefined) {
106106
if (this.inputs.focusMode() === 'roving') {
107107
item.element()?.focus();
108-
} else if (this.inputs.focusMode() === 'activedescendant') {
109-
this.inputs.element()?.focus();
110108
}
111109
}
112110

src/components-examples/aria/simple-combobox/simple-combobox-grid/simple-combobox-grid-example.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<div ngGridRow class="example-grid-row" [attr.aria-selected]="item === selectedItem()">
1515
<div ngGridCell [id]="item.label + '-label'" [rowIndex]="i" [colIndex]="0"
1616
class="example-cell-label example-cell">
17-
<button ngGridCellWidget class="example-label-button no-active-outline" (click)="selectItem(item)">
17+
<button ngGridCellWidget class="example-label-button example-no-active-outline" (click)="selectItem(item)">
1818
{{item.label}}
1919
</button>
2020
<mat-icon class="example-selected-icon">check</mat-icon>
2121
</div>
2222
<div ngGridCell [id]="item.label + '-delete'" [rowIndex]="i" [colIndex]="1"
2323
class="example-cell-button example-cell ">
24-
<button ngGridCellWidget class="example-button no-active-outline" (click)="removeItem(item)"
24+
<button ngGridCellWidget class="example-button example-no-active-outline" (click)="removeItem(item)"
2525
(pointerdown)="$event.preventDefault()">
2626
<mat-icon>close</mat-icon>
2727
</button>

0 commit comments

Comments
 (0)