Skip to content

Thread active/hidden tab state into preview hosts (retained-pool visibility primitive) #1365

Description

@jacktrnr

Important

Problem — Preview tabs are a retained pool: every open tab's file view stays mounted, and inactive tabs are only hidden (display:none + inert + aria-hidden), never unmounted. A mounted view therefore cannot tell when it becomes hidden or shown, so it cannot save transient UI state before it is hidden or restore it when shown again. This is the missing primitive behind the editor and PDF tab-switch state loss.
Approach — Thread an active accessor (true when the tab is the selected one in its pane) from the retained-pool host down into each preview file view and its editor/PDF renderer. Pure plumbing: no behavior change on its own; it is the enabling dependency for the editor and PDF state-preservation fixes.
Scope — in: passing an active/visible accessor from the Portal host through the preview file view to the editor and PDF renderers · out: any actual save/restore behavior (its consumers).
Assumptions — The host already computes per-tab selection; the reactive layer propagates an accessor without recreating the mounted view.

Acceptance Criteria

  • Each mounted preview view receives an active accessor reflecting whether its tab is currently selected.
  • Toggling tab selection flips active for the affected views.
  • No user-visible behavior change; all existing preview tests remain green.

Testing Decisions

Add a unit/integration test that a selection change flips the active accessor for the mounted hosts. No new suites otherwise — this is plumbing consumed by its two dependents.

Key Decisions

Prop-threading of an accessor (not per-view DOM observation of inert/hidden) keeps the source of truth in the host that already owns selection and stays idiomatic for the reactive layer. The accessor is read by consumers to gate capture/restore.

Constraints & Invariants

Threading the signal must not recreate or remount the retained-pool views — that would defeat the pool and lose the very state we are preserving. No change to tab placement, drag, or close behavior.

Prior Art

The retained-pool Portal host and its per-tab selected state; the preview file view and its editor/PDF children.

Source

Part of #1252. Unblocks #1366 (editor tab-switch state) and #1367 (PDF tab-switch state).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions