Skip to content

Commit 6b93572

Browse files
crisbetoandrewseguin
authored andcommitted
chore: remove duplicated key managers (#6332)
* chore: remove duplicated FocusKeyManager Removes the FocusKeyManager class that was duplicated from the CDK. * chore: also remove duplicate activedescendant
1 parent 34284b9 commit 6b93572

File tree

3 files changed

+3
-57
lines changed

3 files changed

+3
-57
lines changed

src/lib/autocomplete/autocomplete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
ChangeDetectionStrategy,
2121
} from '@angular/core';
2222
import {MdOption} from '../core';
23-
import {ActiveDescendantKeyManager} from '../core/a11y/activedescendant-key-manager';
23+
import {ActiveDescendantKeyManager} from '@angular/cdk/a11y';
2424

2525
/**
2626
* Autocomplete IDs need to be unique across components, so this counter exists outside of

src/lib/core/a11y/activedescendant-key-manager.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,4 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ListKeyManager, ListKeyManagerOption} from './list-key-manager';
10-
11-
/**
12-
* This is the interface for highlightable items (used by the ActiveDescendantKeyManager).
13-
* Each item must know how to style itself as active or inactive and whether or not it is
14-
* currently disabled.
15-
*/
16-
export interface Highlightable extends ListKeyManagerOption {
17-
setActiveStyles(): void;
18-
setInactiveStyles(): void;
19-
}
20-
21-
export class ActiveDescendantKeyManager<T> extends ListKeyManager<Highlightable & T> {
22-
23-
/**
24-
* This method sets the active item to the item at the specified index.
25-
* It also adds active styles to the newly active item and removes active
26-
* styles from the previously active item.
27-
*/
28-
setActiveItem(index: number): void {
29-
Promise.resolve().then(() => {
30-
if (this.activeItem) {
31-
this.activeItem.setInactiveStyles();
32-
}
33-
super.setActiveItem(index);
34-
if (this.activeItem) {
35-
this.activeItem.setActiveStyles();
36-
}
37-
});
38-
}
39-
40-
}
9+
export {ActiveDescendantKeyManager, Highlightable} from '@angular/cdk/a11y';

src/lib/core/a11y/focus-key-manager.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,4 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ListKeyManager, ListKeyManagerOption} from './list-key-manager';
10-
11-
/**
12-
* This is the interface for focusable items (used by the FocusKeyManager).
13-
* Each item must know how to focus itself, whether or not it is currently disabled
14-
* and be able to supply it's label.
15-
*/
16-
export interface FocusableOption extends ListKeyManagerOption {
17-
focus(): void;
18-
}
19-
20-
export class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
21-
/**
22-
* This method sets the active item to the item at the specified index.
23-
* It also adds focuses the newly active item.
24-
*/
25-
setActiveItem(index: number): void {
26-
super.setActiveItem(index);
27-
28-
if (this.activeItem) {
29-
this.activeItem.focus();
30-
}
31-
}
32-
}
9+
export {FocusKeyManager, FocusableOption} from '@angular/cdk/a11y';

0 commit comments

Comments
 (0)