@@ -275,6 +275,7 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
275
275
*/
276
276
function updateIsOpen ( isOpen ) {
277
277
var parent = element . parent ( ) ;
278
+ var focusEl = sidenavCtrl . focusElement ( ) ;
278
279
279
280
parent [ isOpen ? 'on' : 'off' ] ( 'keydown' , onKeyDown ) ;
280
281
backdrop [ isOpen ? 'on' : 'off' ] ( 'click' , close ) ;
@@ -283,7 +284,6 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
283
284
// Capture upon opening..
284
285
triggeringElement = $document [ 0 ] . activeElement ;
285
286
}
286
- var focusEl = sidenavCtrl . focusElement ( ) ;
287
287
288
288
disableParentScroll ( isOpen ) ;
289
289
@@ -304,12 +304,16 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
304
304
*/
305
305
function disableParentScroll ( disabled ) {
306
306
var parent = element . parent ( ) ;
307
- if ( disabled ) {
307
+ if ( disabled && ! lastParentOverFlow ) {
308
+
308
309
lastParentOverFlow = parent . css ( 'overflow' ) ;
309
310
parent . css ( 'overflow' , 'hidden' ) ;
311
+
310
312
} else if ( angular . isDefined ( lastParentOverFlow ) ) {
313
+
311
314
parent . css ( 'overflow' , lastParentOverFlow ) ;
312
315
lastParentOverFlow = undefined ;
316
+
313
317
}
314
318
}
315
319
@@ -404,7 +408,7 @@ function SidenavController($scope, $element, $attrs, $mdComponentRegistry, $q) {
404
408
return focusElement ;
405
409
} ;
406
410
407
- self . $toggleOpen = function ( ) { return $q . when ( $scope . isOpen ) ; } ;
411
+ self . $toggleOpen = function ( value ) { return $q . when ( $scope . isOpen = value ) ; } ;
408
412
409
413
self . destroy = $mdComponentRegistry . register ( self , $attrs . mdComponentId ) ;
410
414
}
0 commit comments