Skip to content

Commit

Permalink
Revert "fix(a11y): activeItem out of date if active index is removed …
Browse files Browse the repository at this point in the history
…from ListKeyManager" (#14467)

* Revert "build: update sauce connect (#14422)"

This reverts commit bc563b7.

* Revert "build: changelog script not filtering duplicate entries (#14421)"

This reverts commit fe46290.

* Revert "build: update to angular 7.1.2 (#14418)"

This reverts commit e1487df.

* Revert "refactor(drag-drop): move logic out of directives (#14350)"

This reverts commit 19f9bca.

* Revert "fix(checkbox): redirect focus to underlying input element (#13959)"

This reverts commit e0eb3df.

* Revert "fix(radio): host element unable to receive focus events (#13956)"

This reverts commit 41eb27e.

* Revert "fix(a11y): activeItem out of date if active index is removed from ListKeyManager (#14407)"

This reverts commit 014dc79.
  • Loading branch information
mmalerba committed Dec 11, 2018
1 parent bc563b7 commit 8f790f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/cdk/a11y/key-manager/list-key-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ describe('Key managers', () => {
expect(keyManager.activeItem!.getLabel()).toBe('one');
});

it('should keep the active item in sync if the active item is removed', () => {
expect(keyManager.activeItemIndex).toBe(0);
expect(keyManager.activeItem!.getLabel()).toBe('one');

itemList.items.shift();
itemList.notifyOnChanges();

expect(keyManager.activeItemIndex).toBe(0);
expect(keyManager.activeItem!.getLabel()).toBe('two');
});

it('should start off the activeItem as null', () => {
expect(new ListKeyManager([]).activeItem).toBeNull();
});
Expand Down
4 changes: 2 additions & 2 deletions src/cdk/a11y/key-manager/list-key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export class ListKeyManager<T extends ListKeyManagerOption> {
const itemArray = newItems.toArray();
const newIndex = itemArray.indexOf(this._activeItem);

if (newIndex !== this._activeItemIndex) {
this.updateActiveItem(newIndex > -1 ? newIndex : this._activeItemIndex);
if (newIndex > -1 && newIndex !== this._activeItemIndex) {
this._activeItemIndex = newIndex;
}
}
});
Expand Down

0 comments on commit 8f790f5

Please sign in to comment.