-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug] LinkTo won't transition if a parent element stopPropagation #19546
Comments
This is one of those hairy things that should be fixed in 3.27 / RFC #671. This is true for all classic components – because they use event delegation and listens on the |
@chancancode Did you mean to link to emberjs/rfcs#671 instead of #671? We are now experiencing an issue in our Production builds after upgrading to 3.27 where |
@kpfefferle hmm, that is strange: I would think in 3.27 you would be less likely to run into issues like that, because on the modernized version the handler is attached directly on the One thing you can try is to call |
Same here with 3.27. I don't now how linkTo decides. As @kpfefferle said some behaves like an a tag and creates a request some uses the router. No issue on 3.26.x. |
Something very similar here: upgrading to 3.27+ would make |
This (from
fails when the LinkTo contains any other element, and the click goes to the contained element. The |
@lele-melis This is a great find! It seems consistent with the issues we're seeing too - as the links that exhibit this behavior for us often contain something like an SVG icon 🕵️♀️ @chancancode Does this additional info give you any ideas why the recent refactor may have caused this regression? Did removing the |
During bubbling, `event.target` may point to a child element whereas `event.currentTarget` always points to the element where the handler was attached, which is what we want here. Reported in a comment on #19546, though this may be a distinct issue from the original report as it was reported as a default-cancelling parent element interfering with the nested `<LinkTo>`, and this is the other way around.
@lele-melis @kpfefferle Good find, thanks for reporting and sorry it wasn't caught sooner (the assertions do run in tests, as well as inside the test suite in apps). I proposed a fix in #19597, but I am not sure if this is actually the same issue @jbescoyez reported as this parent-child relationship is the other way around here. |
During bubbling, `event.target` may point to a child element whereas `event.currentTarget` always points to the element where the handler was attached, which is what we want here. Reported in a comment on #19546, though this may be a distinct issue from the original report as it was reported as a default-cancelling parent element interfering with the nested `<LinkTo>`, and this is the other way around.
During bubbling, `event.target` may point to a child element whereas `event.currentTarget` always points to the element where the handler was attached, which is what we want here. Reported in a comment on #19546, though this may be a distinct issue from the original report as it was reported as a default-cancelling parent element interfering with the nested `<LinkTo>`, and this is the other way around. (cherry picked from commit 57907a4)
During bubbling, `event.target` may point to a child element whereas `event.currentTarget` always points to the element where the handler was attached, which is what we want here. Reported in a comment on #19546, though this may be a distinct issue from the original report as it was reported as a default-cancelling parent element interfering with the nested `<LinkTo>`, and this is the other way around. (cherry picked from commit 57907a4)
That fix was released in 3.27.5 |
During bubbling, `event.target` may point to a child element whereas `event.currentTarget` always points to the element where the handler was attached, which is what we want here. Reported in a comment on emberjs#19546, though this may be a distinct issue from the original report as it was reported as a default-cancelling parent element interfering with the nested `<LinkTo>`, and this is the other way around.
🐞 Describe the Bug
When a
<LinkTo>
is inserted inside an element thatstopPropagation
ofclick
's, it won't transition but rather fallback on a default<a>
behavior.🔬 Minimal Reproduction
<LinkTo>
inside an element thatstopPropagation
onclick
.https://ember-twiddle.com/bac43dc0c91d12e7a9afb1d4adfcaabd
😕 Actual Behavior
<a>
behavior🤔 Expected Behavior
route
.🌍 Environment
The text was updated successfully, but these errors were encountered: