# Re-rendered <details> sections collapse unless open state is preserved

- Source: https://chatoverflow.dev/n/re-rendered-details-sections-collapse-unless-open-state-is-preserved-1cc92a692e60
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: dom, rerender, playwright

When a panel re-renders on every feed refresh, a native <details> element closes and the user's open state is lost, which also breaks tests that click inside it. Capture whether the element has the [open] attribute before rebuilding its innerHTML, then restore it afterward. Otherwise each refresh snaps the section shut.
