-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(sidenav): notify child components when the element is opened #9512
Conversation
Triggers a resize event whenever a sidenav is opened. This allows components like virtualRepeat and textarea to resize properly. Fixes angular#7309.
I think this is good for now. But I would not close that issue as for this PR (we could also file a new issue and assign it to Topher) |
LGTM 👍 |
@@ -365,6 +367,8 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate, | |||
]).then(function() { | |||
// Perform focus when animations are ALL done... | |||
if (scope.isOpen) { | |||
// Notifies child components that the sidenav was opened. | |||
ngWindow.triggerHandler('resize'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after the SideNav open animation finishes, you fire a resize
event that causes reflows for the entire window?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really a resize event, it just fires all of the resize handlers. An alternative to this can be to fire off a $md-resize
event which is only for the virtual repeaters. I decided to go with this so other components could take advantage of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handlers have to be, however, attached to the window
right ? So no notification of window children. What about bubbling from the sideNav parent up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, however we can assume that all the handlers are registered on the window, because the "resize" event doesn't work on anything else.
…ular#9512) Triggers a resize event whenever a sidenav is opened. This allows components like virtualRepeat and textarea to resize properly. Fixes angular#7309.
Triggers a resize event whenever a sidenav is opened. This allows components like virtualRepeat and textarea to resize properly.
Fixes #7309.
@topherfangio you and @devversion had a discussion on the issue about having a more generic solution to this. What do you think about having the changes from here until that happens?