Skip to content

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

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

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

Let phone and narrow-window users step Back through open tabs of a thread instead of leaving it. At 980 px or less, the work area shows one tab at a time, so Back used to leave the thread.

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-mode tabs in apps/web/src/fork/workArea/ with a session-storage map keyed by entry key, skip deleted-thread entries, call useTabHistory in WorkArea.tsx, and update README.md.

Scope

Only apps/web/src/fork/workArea/ and README.md. Upstream files and UI text are unchanged.

Tradeoffs

Long-press multi-entry jumps do not change tabs. Switching a tab during thread deletion goes home instead of to the next thread. Back from Settings onto a tab entry keeps the current tab.

Blast Radius

Limited to apps/web/src/fork/workArea/. Wide windows add no entries and only skip same-URL leftovers and deleted-thread entries.

Verification

Memory-history unit tests, Chromium real-history tests, existing work-area tests, and changed-files checks pass.

Details

Behaviour rules

  • Narrow mode applies at 980 px or less under (max-width: 980px), showing one tab at a time.
  • Tab records live in a map keyed by __TSR_key in session storage for the newest 500 entries. Records survive reload, and blocked or corrupted storage is ignored. The app writes no history state and never replaces an entry, so same-URL router navigation stays unchanged.
  • In narrow mode, user tab opens and switches push a new entry. Any untagged entry of the shown thread records the shown tab on start and after each history event, so closing Settings, quote links, or re-clicking the open thread step back cleanly.
  • Back shows the previous open tab without closing the current one, Forward reverses it, and Back from the starting tab leaves the thread.
  • Back and Forward skip closed tabs, skip same-URL entries for the shown tab, and skip deleted-thread entries in narrow and wide windows. Entries with another URL, such as a quote link, navigate normally.
  • Opening a quote link's cited side chat updates that entry's record. Any other tab change pushes a new entry without the quote hash.
  • Closes, deleting a thread's panel state, agent reveals, auto-opened tabs, Reopen Closed View, Settings or Usage overlays, draft threads, and linked-thread pages add no entries. Back or Forward cancels any pending tab push.
  • Wide windows add no entries and skip same-URL leftover entries of the shown thread. Reload keeps the saved tab.

Per-file notes

In apps/web/src/fork/workArea/:

  • tabHistoryTags.ts adds TabTags, createTabTags, and tabHistoryTags for the session-storage map.
  • tabHistory.logic.ts adds TabEntry, readTabEntry, layoutOf, userShownTabChange, planPush, and decideMove.
  • tabHistory.ts adds watchTabHistory and useTabHistory for browser and Electron hash history.
  • useThreadGone.ts exports readThreadGone, returning true when a loaded, complete thread list omits the thread.
  • WorkArea.tsx calls useTabHistory. README.md notes narrow-mode Back under the work area bullet.

Tests

  • tabHistory.logic.test.ts unit tests on memory history cover decisions, store actions, storage, quote links, Settings, Reopen Closed View, push cancellation, and deleted threads.
  • tabHistory.browser.test.tsx Chromium tests on real browser history cover narrow steps, desktop no entries, a main-chat quote then Back, a queued Reopen Closed View at narrow and desktop widths, and Back past a deleted thread.
  • Existing work-area tests 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 +38 test cases (browser +5, unit +33, 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 b3f8ff2.

This comment will update automatically after the next completed run.

In a window 980 px wide or less, a user's tab open or switch pushes a
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 deleted threads, and leaves the thread after the starting
tab. Entries the app adds itself are tagged when reached, quote links keep
their own reveal, and Reopen Closed View adds no entry. Wide windows push
nothing and skip leftover same-URL tab entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@orbitingflea
orbitingflea force-pushed the feat/fullscreen-panels-narrow-back branch from 746ec96 to b3f8ff2 Compare November 24, 2026 15:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 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