question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom elements aren't treated as turbo frames

See original GitHub issue

Hi! 👋

There is an issue between turbo and tables - turbo-frames cannot wrap tr, tbody and similar elements without breaking the styles. One of the workarounds is to use custom-elements and just write <tr is="turbo-frame"> - solves most of the problems.

However, if you do a request from within this fake turbo-frame element and the response returns a template, turbo cannot find a matching turbo-frame element and returns an error: Response has no matching <turbo-frame...

Personally I fixed it with patching turbo query selecting. Currently it’s:

querySelector(`turbo-frame#${id}`)

Changing it to this worked:

querySelector(`turbo-frame#${id}, [is="turbo-frame"]#${id}`)

Would this change be acceptable as a PR or this (custom elements with is=“” attribute) is not the way to go with turbo?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
francesco-loreticommented, May 13, 2022

Changing it to this worked:

querySelector(`turbo-frame#${id}, [is="turbo-frame"]#${id}`)

Would this change be acceptable as a PR or this (custom elements with is=“” attribute) is not the way to go with turbo?

Promote this solution with Pull Request and wait for the result. I need to use tables and your solution, it also supports browsers that do not support the “is” attribute for the moment.

0reactions
dvisockascommented, Jun 8, 2022

I wanted to add test cases before opening PR, but somehow can’t get test to properly work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom elements aren't treated as turbo frames #313 - GitHub
Hi! There is an issue between turbo and tables - turbo-frames cannot wrap tr, tbody and similar elements without breaking the styles.
Read more >
Turbo frames not working - Hotwire Discussion
Any help? It sounds like Turbo might be loaded twice and it's trying to define an existing turbo custom element. Has anything recently...
Read more >
Turbo Frames on Rails - Colby.so
Turbo Frames and page layouts​​ Turbo Frames in the DOM are implemented as custom HTML elements (the <turbo-frame> tag we've seen in this...
Read more >
Rails: Turbo Frame / Turbo Stream element is not rendered ...
Rails: Turbo Frame / Turbo Stream element is not rendered the SECOND time I trigger it - Stack Overflow. Stack Overflow for Teams...
Read more >
Documentation for turbo-rails (1.0.0) - RubyDoc.info
Turbo reinvents the old HTML technique of frames without any of the drawbacks that lead to developers abandoning it. With Turbo Frames, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found