Skip to content
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

turbo_frame_tag does not properly wrap tables or elements within a table #88

Closed
crimson-knight opened this issue Jan 22, 2021 · 2 comments

Comments

@crimson-knight
Copy link

I use lots of tables and I've written some cool Stimulus controllers to handle a lot of the inline edit/update/destroy that I need, but I wanted to move to Hotwire instead of trying to maintain my own.

So I found out really quickly if you try:

<table>
  <thead>
    <tr>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <%= turbo_frame_tag "interesting_table" do %>
      <tr>
        <td>Something... something...</td>
        <td>...darkside</td>
      </tr>
    <% end %>
  </tbody>
</table>

The turbo frame will render OUTSIDE of and BEFORE the <tbody> tag, like this:

<turbo-frame id="interesting_table"></turbo-frame>
<table>
  <thead>
    <tr>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
      <tr>
        <td>Something... something...</td>
        <td>...darkside</td>
      </tr>
  </tbody>
</table>

You can re-create exactly this by running rails new ... and on a scaffolded index page try wrapping the table in the turbo_frame_tag around the basic table provided and it will NOT render the frame around the table body or within the <table> tag.

Nothing I do changes this. Is this on purpose? This seems like extremely odd behavior, but hey if I missed something please let me know! :)

Otherwise I may dive into this and make a PR. I'd love a chance to contribute! Especially since I was already building something very similar on my own projects.

@seanpdoyle
Copy link
Contributor

Is this a duplicate of hotwired/turbo#48?

@crimson-knight
Copy link
Author

Sure is! Thanks @seanpdoyle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants