Don't collapse `<details>`

If I update anything in the <summary> it collapses the open <details>.

<div id="details" phx-update="stream">
  <%= for {id, test} <- @streams.tests do %>
    <details id={"details_#{id}"}>
      <summary id={"summary_#{id}"}>
        <span id={"content_#{id}"}>
          <%= test.summary %>
      <%= test.detail %>
  <% end %>

If I watch the dev inspector, the <details> is left alone on update if it’s collapsed, but if it’s open, <details> is replaced.

if I update the <summary> in JS, this doesn’t happen. I don’t want to manage the open attribute myself. I can use a hook, I guess, but I’d rather stay in the LV update model so I’m just trying to understand why this happens and if there’s a way I can get the behavior I want with the standard update mechanism.

1 Like
1 Like

Great, thanks.

Man, I wish Google were a bit better at its job.