Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 6f72bef

Browse files
fix( sidenav): corrected use of internal $toggleOpen()
1 parent 2668ba0 commit 6f72bef

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/components/sidenav/sidenav.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
275275
*/
276276
function updateIsOpen(isOpen) {
277277
var parent = element.parent();
278+
var focusEl = sidenavCtrl.focusElement();
278279

279280
parent[isOpen ? 'on' : 'off']('keydown', onKeyDown);
280281
backdrop[isOpen ? 'on' : 'off']('click', close);
@@ -283,7 +284,6 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
283284
// Capture upon opening..
284285
triggeringElement = $document[0].activeElement;
285286
}
286-
var focusEl = sidenavCtrl.focusElement();
287287

288288
disableParentScroll(isOpen);
289289

@@ -304,12 +304,16 @@ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstan
304304
*/
305305
function disableParentScroll(disabled) {
306306
var parent = element.parent();
307-
if ( disabled ) {
307+
if ( disabled && !lastParentOverFlow ) {
308+
308309
lastParentOverFlow = parent.css('overflow');
309310
parent.css('overflow', 'hidden');
311+
310312
} else if (angular.isDefined(lastParentOverFlow)) {
313+
311314
parent.css('overflow', lastParentOverFlow);
312315
lastParentOverFlow = undefined;
316+
313317
}
314318
}
315319

@@ -404,7 +408,7 @@ function SidenavController($scope, $element, $attrs, $mdComponentRegistry, $q) {
404408
return focusElement;
405409
};
406410

407-
self.$toggleOpen = function() { return $q.when($scope.isOpen); };
411+
self.$toggleOpen = function(value) { return $q.when($scope.isOpen = value); };
408412

409413
self.destroy = $mdComponentRegistry.register(self, $attrs.mdComponentId);
410414
}

0 commit comments

Comments
 (0)