feat(sidenav): track sidenav visibility and enter / leave backdrop if needed#6486
feat(sidenav): track sidenav visibility and enter / leave backdrop if needed#6486devversion wants to merge 1 commit intoangular:masterfrom
Conversation
There was a problem hiding this comment.
Brackets, scope.isOpen == true is the same as scope.isOpen and ternary operator
b89b094 to
950216f
Compare
|
@EladBezalel - Completed all your suggestions, thanks for reviewing! |
fcfff73 to
b2d0548
Compare
|
@EladBezalel - Fixed the suggestions + Improved |
There was a problem hiding this comment.
why not doing
if (computedStyle && window.getComputedStyle(element[0]).display === 'none' ||
offsetParent && !element[0].offsetParent) {
return true;
}There was a problem hiding this comment.
Yes that's also possible, but I thought we should have a clear variant, because this method is really important and needs to be easy to understand, but if you want I can simplify the code?
b2d0548 to
9fd9ed6
Compare
There was a problem hiding this comment.
Isn't that equals to:
scope.isOpen = !(isHidden(true, true) && scope.isOpen);There was a problem hiding this comment.
No that works not, because I noticed that we only should update if that if statements are true, and we should not set the scope always
There was a problem hiding this comment.
Sorry i couldn't understand, are we watching for isOpen changes?
There was a problem hiding this comment.
Sorry for the late answer. Yes updateIsOpen (the actual method which triggers open and close animations) is called by watching isOpen.
6e426c1 to
e8817ee
Compare
There was a problem hiding this comment.
Is this function is generic enough to be on the util service?
There was a problem hiding this comment.
Yes, definitely, should I add it?
There was a problem hiding this comment.
Done 👍 Added to Util + added tests to validate the functionality.
e8817ee to
8c2c521
Compare
There was a problem hiding this comment.
Done ✋ I should definitely use that conventions (how I call it) in my next PR's so we would save much time 😄 - Already done in my newer PR's
8c2c521 to
94c0d6f
Compare
| scope.isOpen = !!oldValue; | ||
| return; | ||
| } | ||
| element.toggleClass('md-closed', wasClosed); |
There was a problem hiding this comment.
Can't you reuse that?
element.removeClass('md-closed');
if ($mdUtil.isHidden(element, true, false) && !skipSidenav) {
skipNextUpdate = true;
scope.isOpen = !!oldValue;
}
element.toggleClass('md-closed', wasClosed);There was a problem hiding this comment.
No, won't work, because I need to revert the class before the scope watcher will be triggered.
There was a problem hiding this comment.
element.removeClass('md-closed');
var isHidden = $mdUtil.isHidden(element, true, false);
element.toggleClass('md-closed', wasClosed);
if (isHidden && !skipSidenav) {
skipNextUpdate = true;
scope.isOpen = !!oldValue;
}?
There was a problem hiding this comment.
This still needs the return, but yes this will work, because we check before removing the class 👍
-> Updated
|
@ThomasBurleson please review |
|
@EladBezalel I think this PR is not really a high priority, not much developers are complaining about it. What do you think? Should we remove it from the deprecation progress? |
|
This issue is closed as part of our ‘Surge Focus on Material 2' efforts. |
Fixes #4595