This repository was archived by the owner on Oct 2, 2019. It is now read-only.
fix: close drop-down regardless of stopPropagation()
calls
#2003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug description
As of now, a click event-handler on the
$document
is responsible for closing an open drop-down.The click-event stops bubbling when
stopPropagation()
is called anywhere on the DOM before the$document
. This breaks the closing of the drop-down.Proposed solution
Registering the event-listener in the capture phase instead of the bubble phase fixes this bug.
Plunkers
Failing use-case: http://plnkr.co/edit/MWOhIKdUNpoQK5OWTC5G
Fixed use-case: http://plnkr.co/edit/jC2R9QJGUrbzljr0YR1C
Additional information
I tested the examples and they're still working with my proposed solution. Tests are also succeeding, including the one i added.
Angular version used downstream: v1.5.11
angular-ui version used downstream: 0.19.4