@@ -442,14 +442,6 @@ function MdDialogProvider($$interimElementProvider) {
442
442
}
443
443
} ;
444
444
445
- function trapFocus ( ev ) {
446
- var dialog = document . querySelector ( 'md-dialog' ) ;
447
-
448
- if ( dialog && ! dialog . contains ( ev . target ) ) {
449
- ev . stopImmediatePropagation ( ) ;
450
- dialog . focus ( ) ;
451
- }
452
- }
453
445
454
446
// On show method for dialogs
455
447
function onShow ( scope , element , options ) {
@@ -484,11 +476,9 @@ function MdDialogProvider($$interimElementProvider) {
484
476
485
477
configureAria ( element . find ( 'md-dialog' ) , role , options ) ;
486
478
487
- document . addEventListener ( 'focus' , trapFocus , true ) ;
488
479
489
480
if ( options . disableParentScroll ) {
490
- options . lastOverflow = options . parent . css ( 'overflow' ) ;
491
- options . parent . css ( 'overflow' , 'hidden' ) ;
481
+ options . restoreScroll = $mdUtil . disableScrollAround ( element ) ;
492
482
}
493
483
494
484
return dialogPopIn (
@@ -546,8 +536,7 @@ function MdDialogProvider($$interimElementProvider) {
546
536
$animate . leave ( options . backdrop ) ;
547
537
}
548
538
if ( options . disableParentScroll ) {
549
- options . parent . css ( 'overflow' , options . lastOverflow ) ;
550
- delete options . lastOverflow ;
539
+ options . restoreScroll ( ) ;
551
540
}
552
541
if ( options . escapeToClose ) {
553
542
$rootElement . off ( 'keyup' , options . rootElementKeyupCallback ) ;
@@ -558,7 +547,6 @@ function MdDialogProvider($$interimElementProvider) {
558
547
559
548
applyAriaToSiblings ( element , false ) ;
560
549
561
- document . removeEventListener ( 'focus' , trapFocus , true ) ;
562
550
563
551
return dialogPopOut (
564
552
element ,
0 commit comments