6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
10
9
import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform' ;
11
10
import { DOCUMENT } from '@angular/common' ;
12
11
import {
@@ -21,6 +20,7 @@ import {
21
20
DoCheck ,
22
21
SimpleChanges ,
23
22
OnChanges ,
23
+ booleanAttribute ,
24
24
} from '@angular/core' ;
25
25
import { take } from 'rxjs/operators' ;
26
26
import { InteractivityChecker } from '../interactivity-checker/interactivity-checker' ;
@@ -413,26 +413,19 @@ export class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoC
413
413
private _previouslyFocusedElement : HTMLElement | null = null ;
414
414
415
415
/** Whether the focus trap is active. */
416
- @Input ( 'cdkTrapFocus' )
416
+ @Input ( { alias : 'cdkTrapFocus' , transform : booleanAttribute } )
417
417
get enabled ( ) : boolean {
418
418
return this . focusTrap . enabled ;
419
419
}
420
- set enabled ( value : BooleanInput ) {
421
- this . focusTrap . enabled = coerceBooleanProperty ( value ) ;
420
+ set enabled ( value : boolean ) {
421
+ this . focusTrap . enabled = value ;
422
422
}
423
423
424
424
/**
425
425
* Whether the directive should automatically move focus into the trapped region upon
426
426
* initialization and return focus to the previous activeElement upon destruction.
427
427
*/
428
- @Input ( 'cdkTrapFocusAutoCapture' )
429
- get autoCapture ( ) : boolean {
430
- return this . _autoCapture ;
431
- }
432
- set autoCapture ( value : BooleanInput ) {
433
- this . _autoCapture = coerceBooleanProperty ( value ) ;
434
- }
435
- private _autoCapture : boolean ;
428
+ @Input ( { alias : 'cdkTrapFocusAutoCapture' , transform : booleanAttribute } ) autoCapture : boolean ;
436
429
437
430
constructor (
438
431
private _elementRef : ElementRef < HTMLElement > ,
0 commit comments