From 75f12fcd96655691940d4f50cf3667c739512f76 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Mon, 7 Aug 2017 22:59:36 +0200 Subject: [PATCH 1/2] chore: remove duplicated FocusKeyManager Removes the FocusKeyManager class that was duplicated from the CDK. --- src/lib/core/a11y/focus-key-manager.ts | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/lib/core/a11y/focus-key-manager.ts b/src/lib/core/a11y/focus-key-manager.ts index 8c8f06102a87..0a603e1eba27 100644 --- a/src/lib/core/a11y/focus-key-manager.ts +++ b/src/lib/core/a11y/focus-key-manager.ts @@ -6,27 +6,4 @@ * found in the LICENSE file at https://angular.io/license */ -import {ListKeyManager, ListKeyManagerOption} from './list-key-manager'; - -/** - * This is the interface for focusable items (used by the FocusKeyManager). - * Each item must know how to focus itself, whether or not it is currently disabled - * and be able to supply it's label. - */ -export interface FocusableOption extends ListKeyManagerOption { - focus(): void; -} - -export class FocusKeyManager extends ListKeyManager { - /** - * This method sets the active item to the item at the specified index. - * It also adds focuses the newly active item. - */ - setActiveItem(index: number): void { - super.setActiveItem(index); - - if (this.activeItem) { - this.activeItem.focus(); - } - } -} +export {FocusKeyManager, FocusableOption} from '@angular/cdk/a11y'; From 52aead3fe3208597bc6b89187f0f019dfa8870f4 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Mon, 7 Aug 2017 23:03:07 +0200 Subject: [PATCH 2/2] chore: also remove duplicate activedescendant --- src/lib/autocomplete/autocomplete.ts | 2 +- .../core/a11y/activedescendant-key-manager.ts | 33 +------------------ 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/lib/autocomplete/autocomplete.ts b/src/lib/autocomplete/autocomplete.ts index 53d579664d9c..36a6e7cd6398 100644 --- a/src/lib/autocomplete/autocomplete.ts +++ b/src/lib/autocomplete/autocomplete.ts @@ -20,7 +20,7 @@ import { ChangeDetectionStrategy, } from '@angular/core'; import {MdOption} from '../core'; -import {ActiveDescendantKeyManager} from '../core/a11y/activedescendant-key-manager'; +import {ActiveDescendantKeyManager} from '@angular/cdk/a11y'; /** * Autocomplete IDs need to be unique across components, so this counter exists outside of diff --git a/src/lib/core/a11y/activedescendant-key-manager.ts b/src/lib/core/a11y/activedescendant-key-manager.ts index 40f0d40144c9..8ccabcab6c6a 100644 --- a/src/lib/core/a11y/activedescendant-key-manager.ts +++ b/src/lib/core/a11y/activedescendant-key-manager.ts @@ -6,35 +6,4 @@ * found in the LICENSE file at https://angular.io/license */ -import {ListKeyManager, ListKeyManagerOption} from './list-key-manager'; - -/** - * This is the interface for highlightable items (used by the ActiveDescendantKeyManager). - * Each item must know how to style itself as active or inactive and whether or not it is - * currently disabled. - */ -export interface Highlightable extends ListKeyManagerOption { - setActiveStyles(): void; - setInactiveStyles(): void; -} - -export class ActiveDescendantKeyManager extends ListKeyManager { - - /** - * This method sets the active item to the item at the specified index. - * It also adds active styles to the newly active item and removes active - * styles from the previously active item. - */ - setActiveItem(index: number): void { - Promise.resolve().then(() => { - if (this.activeItem) { - this.activeItem.setInactiveStyles(); - } - super.setActiveItem(index); - if (this.activeItem) { - this.activeItem.setActiveStyles(); - } - }); - } - -} +export {ActiveDescendantKeyManager, Highlightable} from '@angular/cdk/a11y';