-
Notifications
You must be signed in to change notification settings - Fork 3k
ui-sref on a parent element breaks all ui-srefs on children #2962
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
Comments
@christopherthielen, I just discovered a new problem that arises when When the link is part of a dropdown (eg. angular-bootstrap’s one), calling A possible fix might be to let Any better ideas? |
Another way might be to share the transition timeout variable between all But that still feels a bit messy. |
We also run into breaking issues due to this change. We have a ui-sref element that changes the state but its container has also a click event listener that does stuff. With this change the container event is never fired. I strongly recommend to revert this as you cannot rely on event propagation anymore. What do you guys think? |
what if you just wrote a stop-propagation directive for those ui-sref that are doubly nested?
|
@rluba I've reverted the commit for beta.3. Can you try the stopPropagation directive technique? |
I'm currently using my "transition timeout as shared variable" fix in a local fork and it works great. I'll submit a PR as soon as I'm confident that there are no side effects. |
Thanks guys |
Here's a minimal reproduction: http://plnkr.co/edit/vp0aMZgYIuRK2fXvx96b?p=preview Clicking 'home.foo' ui-sref in the |
Here's a viable workaround ( |
I'd like to see your solution. However, know that I'm wary of adding more code (and managing more state) for a case which I don't think is very common and which there is a simple workaround. |
…the transitions started by ui-srefs on child elements
Example use case:
<tr>
is made clickable by addingui-sref="A"
to it.<a>
links to other states (implemented by usingui-sref="B"
on those link tags).When you click on any of those links – because you want to visit state
B
– the link toA
on the<tr>
elements takes precedence becauseui-sref
’s click handler does not calle.stopPropagation()
when it handles the click event. So the transition toB
gets superseded by a transition toA
when the parent element processes the event. Therefore, you always end up in stateA
– no matter where you click.Adding
e.stopPropagation()
somewhere in the click handler solves the problem.Tested with
[email protected]
and[email protected]
The text was updated successfully, but these errors were encountered: