@@ -442,14 +442,6 @@ function MdDialogProvider($$interimElementProvider) {
442442 }
443443 } ;
444444
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- }
453445
454446 // On show method for dialogs
455447 function onShow ( scope , element , options ) {
@@ -484,11 +476,9 @@ function MdDialogProvider($$interimElementProvider) {
484476
485477 configureAria ( element . find ( 'md-dialog' ) , role , options ) ;
486478
487- document . addEventListener ( 'focus' , trapFocus , true ) ;
488479
489480 if ( options . disableParentScroll ) {
490- options . lastOverflow = options . parent . css ( 'overflow' ) ;
491- options . parent . css ( 'overflow' , 'hidden' ) ;
481+ options . restoreScroll = $mdUtil . disableScrollAround ( element ) ;
492482 }
493483
494484 return dialogPopIn (
@@ -546,8 +536,7 @@ function MdDialogProvider($$interimElementProvider) {
546536 $animate . leave ( options . backdrop ) ;
547537 }
548538 if ( options . disableParentScroll ) {
549- options . parent . css ( 'overflow' , options . lastOverflow ) ;
550- delete options . lastOverflow ;
539+ options . restoreScroll ( ) ;
551540 }
552541 if ( options . escapeToClose ) {
553542 $rootElement . off ( 'keyup' , options . rootElementKeyupCallback ) ;
@@ -558,7 +547,6 @@ function MdDialogProvider($$interimElementProvider) {
558547
559548 applyAriaToSiblings ( element , false ) ;
560549
561- document . removeEventListener ( 'focus' , trapFocus , true ) ;
562550
563551 return dialogPopOut (
564552 element ,
0 commit comments