Skip to content

Commit 7718947

Browse files
authored
fix(cdk/a11y): add ConfigurableFocusTrapConfig to the public API (#22138)
- `ConfigurableFocusTrap` is already in the public API and it depends on this class - convert `ConfigurableFocusTrapConfig` from a class to an interface - fix alphabetization of exports Relates to #18201. Relates to #22136.
1 parent c0286ea commit 7718947

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/cdk/a11y/focus-trap/configurable-focus-trap-config.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
*/
88

99
/**
10-
* Configuration for creating a ConfigurableFocusTrap.
10+
* Options for creating a ConfigurableFocusTrap.
1111
*/
12-
export class ConfigurableFocusTrapConfig {
12+
export interface ConfigurableFocusTrapConfig {
1313
/**
14-
* Whether to defer the creation of FocusTrap elements to be
15-
* done manually by the user. Default is to create them
16-
* automatically.
14+
* Whether to defer the creation of FocusTrap elements to be done manually by the user.
1715
*/
18-
defer: boolean = false;
16+
defer: boolean;
1917
}

src/cdk/a11y/focus-trap/configurable-focus-trap-factory.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,11 @@ export class ConfigurableFocusTrapFactory {
5252
*/
5353
create(element: HTMLElement, deferCaptureElements: boolean): ConfigurableFocusTrap;
5454

55-
create(element: HTMLElement, config: ConfigurableFocusTrapConfig | boolean =
56-
new ConfigurableFocusTrapConfig()): ConfigurableFocusTrap {
55+
create(element: HTMLElement, config: ConfigurableFocusTrapConfig|boolean = {defer: false}):
56+
ConfigurableFocusTrap {
5757
let configObject: ConfigurableFocusTrapConfig;
5858
if (typeof config === 'boolean') {
59-
configObject = new ConfigurableFocusTrapConfig();
60-
configObject.defer = config;
59+
configObject = {defer: config};
6160
} else {
6261
configObject = config;
6362
}

src/cdk/a11y/public-api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ export * from './key-manager/activedescendant-key-manager';
1010
export * from './key-manager/focus-key-manager';
1111
export * from './key-manager/list-key-manager';
1212
export * from './focus-trap/configurable-focus-trap';
13+
export * from './focus-trap/configurable-focus-trap-config';
14+
export * from './focus-trap/configurable-focus-trap-factory';
1315
export * from './focus-trap/event-listener-inert-strategy';
1416
export * from './focus-trap/focus-trap';
15-
export * from './focus-trap/configurable-focus-trap-factory';
1617
export * from './focus-trap/focus-trap-inert-strategy';
1718
export * from './interactivity-checker/interactivity-checker';
1819
export * from './live-announcer/live-announcer';

tools/public_api_guard/cdk/a11y.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export declare class ConfigurableFocusTrap extends FocusTrap implements ManagedF
7171
destroy(): void;
7272
}
7373

74+
export interface ConfigurableFocusTrapConfig {
75+
defer: boolean;
76+
}
77+
7478
export declare class ConfigurableFocusTrapFactory {
7579
constructor(_checker: InteractivityChecker, _ngZone: NgZone, _focusTrapManager: FocusTrapManager, _document: any, _inertStrategy?: FocusTrapInertStrategy);
7680
create(element: HTMLElement, config?: ConfigurableFocusTrapConfig): ConfigurableFocusTrap;

0 commit comments

Comments
 (0)