66 * found in the LICENSE file at https://angular.io/license
77 */
88
9- import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
109import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform' ;
1110import { DOCUMENT } from '@angular/common' ;
1211import {
@@ -21,6 +20,7 @@ import {
2120 DoCheck ,
2221 SimpleChanges ,
2322 OnChanges ,
23+ booleanAttribute ,
2424} from '@angular/core' ;
2525import { take } from 'rxjs/operators' ;
2626import { InteractivityChecker } from '../interactivity-checker/interactivity-checker' ;
@@ -413,26 +413,19 @@ export class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoC
413413 private _previouslyFocusedElement : HTMLElement | null = null ;
414414
415415 /** Whether the focus trap is active. */
416- @Input ( 'cdkTrapFocus' )
416+ @Input ( { alias : 'cdkTrapFocus' , transform : booleanAttribute } )
417417 get enabled ( ) : boolean {
418418 return this . focusTrap . enabled ;
419419 }
420- set enabled ( value : BooleanInput ) {
421- this . focusTrap . enabled = coerceBooleanProperty ( value ) ;
420+ set enabled ( value : boolean ) {
421+ this . focusTrap . enabled = value ;
422422 }
423423
424424 /**
425425 * Whether the directive should automatically move focus into the trapped region upon
426426 * initialization and return focus to the previous activeElement upon destruction.
427427 */
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 ;
436429
437430 constructor (
438431 private _elementRef : ElementRef < HTMLElement > ,
0 commit comments