Skip to content

Commit 1543424

Browse files
committed
fixup! refactor(cdk-experimental/ui-patterns): move active index operations into list-focus
1 parent e6735a7 commit 1543424

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/cdk-experimental/ui-patterns/behaviors/list-focus/list-focus.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,4 @@ describe('List Focus', () => {
127127
expect(focusManager.isFocusable(items[2])).toBeTrue();
128128
});
129129
});
130-
131-
describe('#focus', () => {});
132130
});

src/cdk-experimental/ui-patterns/behaviors/list-focus/list-focus.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ export class ListFocus<T extends ListFocusItem> {
8181
if (this.inputs.focusMode() === 'activedescendant') {
8282
return -1;
8383
}
84-
const index = this.inputs.items().indexOf(item);
85-
return this.inputs.activeIndex() === index ? 0 : -1;
84+
return this.activeItem() === item ? 0 : -1;
8685
}
8786

88-
/** Focuses the current active item. */
87+
/** Moves focus to the given item if it is focusable. */
8988
focus(item: T): boolean {
9089
if (this.isListDisabled() || !this.isFocusable(item)) {
9190
return false;

0 commit comments

Comments
 (0)