Open gabrielboeker opened 2 years ago
Hey @gabrielboeker, is the content of the Turbo Frame loaded asynchronously? If so, that would explain why.
The problem with jQuery is, that it's just being evaluated once on first page load. Sadly it's not re-executed if you dynamically add matching elements to the DOM, which would be case with a Turbo Frame.
The ideal solution would be to wrap your logic in a Stimulus controller, so you can control when that element gets connected and then attach the needed event-listener in the callback.
If you still decide to go the jQuery route, you probably need to re-execute your snippet in a turbo:frame-load
or turbo:frame-render
event listener in order to attach your logic to the newly appeared elements.
I can confirm it's a bug and it's very easy to replicate: just add onclick="event.stopPropagation();"
to the \
Any updates on this ?
While jquery implemented in a rails 7 app in
application.js
, ive gotWhen wrapping a turbo frame around some code that includes a
.context-menu-trigger
included,link_to
will break the turbo frame as it would be expected withtarget: "_top"
When moving the
link_to
out of thecontext-menu-trigger
everything works well. I figured its because of thestopPropagation()
which is needed unfortunately. I also tried usingWith no success. Is this a bug or a case for stack overflow?