Skip to content

fix(web): re-apply hidden=true on tab deactivation in activateTab() (closes #699)#737

Merged
pandas-studio merged 2 commits intomainfrom
fix/699-activate-tab-hidden-restore
May 3, 2026
Merged

fix(web): re-apply hidden=true on tab deactivation in activateTab() (closes #699)#737
pandas-studio merged 2 commits intomainfrom
fix/699-activate-tab-hidden-restore

Conversation

@memtomem
Copy link
Copy Markdown
Owner

@memtomem memtomem commented May 3, 2026

Summary

  • activateTab() removed .active from all panels but never set hidden = true back. After the first activation every visited panel ended the session with hidden = false, relying only on the CSS display:none from the absent .active class to stay hidden.
  • Modern browsers do exclude display:none from the a11y tree, so this isn't a hard a11y bug — but Playwright browser_snapshot walks the DOM and dumps the leaked nodes (this is exactly how Tab hidden attribute not re-applied on deactivation in activateTab() #699 surfaced, in the v0.1.34 prod UX review). A future CSS-only refactor that drops display:none would also silently regress hiding.
  • Pair classList.remove('active') with p.hidden = true in the deactivation forEach. Belt-and-braces with the existing CSS rule.
  • Bump app.js cache-buster v97 → v98.

Closes #699.

Test plan

  • Click through all main tabs once (Home → Sources → Search → Index → Tags → Timeline → Settings) then back to Home; in DevTools check every other .tab-panel shows hidden attribute set, only the active panel has hidden = false.
  • Playwright browser_snapshot after the round-trip: only one tab-panel should appear unhidden in the snapshot tree.
  • Confirm no regression: panels still render content correctly when re-activated (focus restoration, history pushState, tab-specific loaders all still fire).

memtomem and others added 2 commits May 3, 2026 15:46
…loses #699)

`activateTab()` removed `.active` from all panels but never set
`hidden = true` back. After the first activation, every visited panel
ended the session with `hidden = false` and relied solely on the CSS
`display: none` from the absent `.active` class to stay hidden.

Modern browsers do exclude `display:none` from the a11y tree, but:

- DOM state accumulates; Playwright snapshots dump every panel that was
  ever activated, leaking stale content into UX review captures (this
  bug was found by exactly that — see
  docs/reports/mm-web-prod-v0.1.34-playwright-review.md).
- A future CSS-only refactor (e.g. switching `.active` to
  `visibility:hidden`) would silently regress a11y. Belt-and-braces is
  cheap.

Pair `classList.remove('active')` with `p.hidden = true` in the
deactivation forEach. Bump app.js cache-buster v97 → v98.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Per CLAUDE.md ("never write multi-paragraph docstrings or multi-line
comment blocks — one short line max"). Same WHY anchored to #699.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copy link
Copy Markdown
Collaborator

@pandas-studio pandas-studio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is correct and scope-appropriate — the change is purely DOM hygiene (both [hidden] { display: none !important } at style.css:6 and the base .tab-panel { display: none } at style.css:216 already hide inactive panels visually), so this is the snapshot-pollution / future-proofing fix #699 advertised, not a hidden visual bug.

Verified:

  • .tab-panel selector is scoped to exactly 7 top-level containers, no sub-component reuse.
  • Initial HTML ships with hidden on inactive panels (60/413/481/588), so the post-fix invariant matches the static markup.
  • Comment trimmed to two lines (just pushed) to comply with CLAUDE.md "one short line max" convention.

Approving.

@pandas-studio pandas-studio merged commit eaf133f into main May 3, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab hidden attribute not re-applied on deactivation in activateTab()

2 participants