-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dropdownToggle): Dropdown not repositioned when window resized #261
base: master
Are you sure you want to change the base?
Conversation
@@ -90,6 +90,16 @@ angular.module('mm.foundation.dropdownToggle', [ 'mm.foundation.position', 'mm.f | |||
} | |||
}; | |||
$document.on('click', closeMenu); | |||
|
|||
angular.element($window).bind('resize', function() { |
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.
Any reason why you use bind()
here instead of on()
like the rest of the event listeners?
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.
We need to clean up this event listener on $destroy
. See https://code.angularjs.org/1.4.7/docs/guide/directive#creating-a-directive-that-manipulates-the-dom
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.
No particular reason for bind()
, changing.
Also, added cleanup on $destroy
as suggested.
Thanks for sending this in, @lerio. In addition to my previous comments can you please try to add some tests for this behavior? |
Did the required changes, but I didn't add any test yet. Can you suggest me a way to test $window resize on jasmine? |
Bump |
Related to #258.
When window is resized, the open dropdown is not correctly repositioned below its toggle. Now the behaviour is correct either when the dropdown is left or right aligned.
Before:
After: