@@ -18,20 +18,15 @@ import {
1818} from '@angular/core' ;
1919import { isBrowser } from '../common/platform' ;
2020import { EventRegistry } from '../common/event-registry' ;
21- import * as createFocusTrap from 'focus-trap' ;
21+ import focusTrap from 'focus-trap' ;
2222
2323import { Ripple } from '.././ripple/ripple.directive' ;
2424import { ButtonComponent } from '../button/button.component' ;
2525
2626import { MDCDialogAdapter } from './dialog-adapter' ;
2727import { MDCDialogFoundation } from '@material/dialog' ;
2828
29- export function createFocusTrapInstance ( surfaceEl , acceptButtonEl , clickOutsideCloses , focusTrapFactory = createFocusTrap ) {
30- return focusTrapFactory ( surfaceEl , {
31- initialFocus : acceptButtonEl ,
32- clickOutsideDeactivates : clickOutsideCloses ,
33- } ) ;
34- }
29+ export { focusTrap } ;
3530
3631@Directive ( {
3732 selector : '[mdc-dialog-surface], mdc-dialog-surface'
@@ -261,10 +256,12 @@ export class DialogComponent implements AfterViewInit, OnDestroy {
261256 }
262257
263258 show ( ) {
264- this . focusTrap_ = createFocusTrapInstance ( this . dialogSurface . elementRef . nativeElement ,
265- this . dialogAcceptButton ? this . dialogAcceptButton . elementRef . nativeElement :
259+ this . focusTrap_ = focusTrap ( this . dialogSurface . elementRef . nativeElement , {
260+ initialFocus : this . dialogAcceptButton ? this . dialogAcceptButton . elementRef . nativeElement :
266261 this . dialogButtons . length > 0 ? this . dialogButtons . find ( ( _ ) => _ . accept ) . elementRef . nativeElement
267- : this . dialogSurface . elementRef . nativeElement , this . clickOutsideToClose ) ;
262+ : this . dialogSurface . elementRef . nativeElement ,
263+ clickOutsideDeactivates : this . clickOutsideToClose ,
264+ } ) ;
268265 this . _foundation . open ( ) ;
269266 }
270267
0 commit comments