Skip to content

feat(web): step Back through open work-area tabs in narrow mode - #283

Closed
orbitingflea wants to merge 1 commit into
proto/fullscreen-panelsfrom
feat/fullscreen-panels-narrow-back
Closed

orbitingflea wants to merge 1 commit into
proto/fullscreen-panelsfrom
feat/fullscreen-panels-narrow-back

Conversation

@orbitingflea

@orbitingflea orbitingflea commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Why

At 980 px or less the work area shows one tab at a time, so Back used to leave the thread instead of stepping through its open tabs.

Behaviour change

Behaviour change: yes, phone and narrow-window users (980 px or less) see Back return to the previous open tab of the thread instead of leaving it; wide windows are unchanged.

What changed

Track narrow tabs with a session-storage map and a router-installed history listener, skip dead entries always and pushed entries when wide, wire WorkArea.tsx, hook router, modal Close, Reopen, and delete, and update README.md.

Scope

apps/web/src/fork/workArea/, README.md, and small hooks in apps/web/src/router.ts, components/sidebar/mainAppLocation.ts, components/ReopenClosedViewShortcut.tsx, and hooks/useThreadActions.ts. UI text is unchanged.

Tradeoffs

Multi-entry jumps from the browser's Back menu keep Forward history and do not change tabs.

Blast Radius

Work-area code plus four small upstream hooks. Wide windows push no user tab entries and skip pushed entries, one base per Back, and dead entries.

Verification

Unit, Chromium browser, existing work-area, router, reopen, delete, and modal-close tests, and changed-files checks pass.

Details

Behaviour rules

  • Narrow mode applies at (max-width: 980px), showing one tab.
  • A session-storage map by entry key stores { thread, tab } for the newest 500 entries, plus pushed on our pushes and dead on deleted threads; blocked storage falls back to memory.
  • In narrow mode, user tab opens and switches push a same-URL pushed entry; untagged entries of the shown thread take the shown tab.
  • Back shows an open tab without closing the current one, Forward reverses it, and Back leaves the thread after its start tab; both skip closed tabs and the shown tab at the same URL.
  • A quote reveal (no pointer, key, or touch input since arrival) retags that entry; later switches push without the quote hash, and Back lets it reveal again.
  • Closing Settings or Usage marks its step back so the listener pushes a hashless pushed entry in both widths, keeping Back and Forward right without reopening the modal; unmarked Back-menu jumps push nothing and keep Forward.
  • One per-history listener, installed in getRouter and never removed, handles marked closes and skips dead entries in both widths plus pushed entries and one base on Back when wide.
  • Closes, thread removals, non-user reveals, and same-tab updates push nothing; Back or Forward cancels a pending push.

Per-file notes

  • tabHistoryTags.ts: TabTags, createTabTags, tabHistoryTags.
  • tabHistory.logic.ts: pure helpers (planPush, decideMove, decideHistoryMove, isTabStep).
  • tabHistory.ts: listener, installTabHistoryHub, noteAppModalClose, markTabHistoryThreadDeleted, onlyOwnTabPushesSince, isWorkAreaTabStep, watchTabHistory, useTabHistory.
  • router.ts: calls installTabHistoryHub in getRouter.
  • components/sidebar/mainAppLocation.ts: calls noteAppModalClose before Close steps back.
  • WorkArea.tsx calls useTabHistory; README.md notes narrow Back.
  • components/ReopenClosedViewShortcut.tsx: checks onlyOwnTabPushesSince for queued reopens.
  • hooks/useThreadActions.ts: marks deleted threads and side chats with markTabHistoryThreadDeleted; checks isWorkAreaTabStep.

Tests

  • tabHistory.logic.test.ts: pure rules, skips, storage, quotes, modal Close, unmarked GO, basepath, push runs, listener order, deleted threads.
  • tabHistory.browser.test.tsx: narrow steps, wide and fresh-mount skips, quotes, narrow and wide modal Close, Back-menu jumps, Reopen races, deleted side chats, delete steps, reload skips.
  • Existing work-area, router, reopen, delete, modal-close, and changed-files checks pass.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

This PR changes the test suite by +74 test cases (browser +25, unit +49, server 0).

New browser test files: apps/web/src/fork/workArea/tabHistory.browser.test.tsx.
Each browser test file costs CI seconds of module loading before its first test runs; a unit test costs milliseconds.

Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for f657900.

This comment will update automatically after the next completed run.

@orbitingflea
orbitingflea force-pushed the feat/fullscreen-panels-narrow-back branch from 746ec96 to b3f8ff2 Compare November 24, 2026 15:16
In a window 980 px wide or less, a user's tab open or switch pushes a
same-URL history entry, and a session-storage map keyed by the entry's
key records the thread and tab it shows. Back shows the previous open
tab, skips closed tabs, and leaves the thread after the starting tab.

One history listener per browser history, installed with the router,
makes the skips that must not depend on the shown thread: wide windows
step as if the tab entries were not there, and entries of deleted
threads (and their side chats) are skipped. Entries the app adds itself
are tagged when reached, a quote link keeps its own reveal, closing
Settings or Usage keeps Forward free of the modal, and Reopen Closed
View and the delete fallback treat our tab steps as no navigation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@orbitingflea
orbitingflea force-pushed the feat/fullscreen-panels-narrow-back branch from b3f8ff2 to f657900 Compare November 24, 2026 22:52
@github-actions github-actions Bot added size:XL and removed size:L labels Nov 24, 2026
@orbitingflea

Copy link
Copy Markdown
Owner Author

Closing in favor of a minimal narrow-only, zero-upstream-file rebuild targeting proto/fullscreen-panels.

@orbitingflea
orbitingflea deleted the feat/fullscreen-panels-narrow-back branch November 25, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant