Skip to content

Let the phone's back close what's open — the lightbox, dialogs and the History view ignore the one close input phones have today, so a back gesture leaves the app mid-read #202

Closed as not planned

Description

@bencode

Problem

Every fullscreen overlay in the app — the image lightbox (ui-packages/web/src/features/conversation/image-lightbox.tsx:90-94), every dialog built on the shared ConfirmationDialog (ui-packages/web/src/components/confirmation-dialog/index.tsx:19-21), the third showModal user in ui-packages/web/src/shell/workbench.tsx, and the History view that replaces the assistant panel (ui-packages/web/src/features/conversation/conversation-panel.tsx:246-261) — closes by Esc or an on-screen X only. None of them touches the session history: the only history calls in the codebase are replaceState for URL hygiene (ui-packages/web/src/shell/project-root.tsx:54-99), and pushState/popstate appear nowhere.

A desktop reader has Esc; a phone reader's one reflexive close input — the back gesture on iOS or the back button on Android, inside or outside the installed app (#56) — is not wired to any of them. So a reader who taps an attachment to see it large, opens the model settings, or steps into History, and then swipes back, does not close what is open: the tab navigates to whatever came before the app (or the PWA drops to the launcher), interrupting the read mid-context. The overlay stays exactly where it was only if the reader thinks to use the small X instead of the gesture every phone trains.

Proposal

  • Give each fullscreen overlay a history entry while it is open: push on open, close on popstate, and let Esc / the X button keep working (closing also drops the pushed entry).
  • Cover the History view the same way, so phone back returns to the conversation instead of leaving the app.

Goal

After this, on a phone, back from the image lightbox, any dialog, or the History view closes it and returns the reader to where they were; only back with nothing open leaves the app.

Verification

grep -rEq "pushState|popstate" ui-packages/web/src/components/confirmation-dialog ui-packages/web/src/features/conversation
pnpm --filter @gamma-reader/web test --silent
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 23, 2026
  2. bencode commented on Oct 23, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Evidence audit (HEAD da3dfad): confirmed, every anchor exact. Exactly three showModal sites — image-lightbox.tsx:90-94, confirmation-dialog/index.tsx:19-21, workbench.tsx:115 (the files/assistant overlay) — none touch history; the History view swaps the panel Activity with onBack={showChat} as its only way back (conversation-panel.tsx:246-261); across ui-packages/web/src the only history calls are four replaceState in project-root.tsx:54-99; pushState/popstate: zero matches. Referenced issues check out: #56 closed (installable), #176/#187/#195 open.

    Duplicate check: none across open + closed titles.

    Sensor: lint ✓ · verify ✗ (expected — no pushState/popstate yet).

    Sharpening:

    • Four call sites (lightbox, shared dialog, workbench overlay, History view) — one shared hook (push on open, close on popstate, drop the entry on Esc/X) avoids four divergent implementations; Esc already closes via the dialog's onCancel, so the guard must not double-close or leave a stray entry.
    • Stacked overlays (dialog over lightbox) need LIFO entries, and a project switch while an overlay is open will run project-root's replaceState against a stack that holds pushed entries — worth one line in the proposal.
    • The verification grep is a presence check; the outcome anchor: fire popstate in jsdom and assert the overlay/History closes; close via Esc/X and assert no stray entry remains.

    Valid; stays open.

  3. bencode commented on Oct 25, 2026

    @bencode
    OwnerAuthor

    Independent re-review — posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audited at HEAD 90b046f. Commits since the last review (93563a2, merge #203) touch only ui-packages/web/src/styles.css (resource-row hover overlay) — no overlay, dialog or history surface changed.

    Evidence audit: all anchors still exact — exactly three showModal sites (image-lightbox.tsx:92, confirmation-dialog/index.tsx:20, workbench.tsx:115), pushState/popstate still zero matches in ui-packages/web/src, only history calls remain the four replaceState in project-root.tsx:54-99, History swap with onBack={showChat} at conversation-panel.tsx:246-261.

    Sensor: lint ✓ · verify ✗ (still unimplemented, as expected).

    Duplicate check: clean (open + closed); #56 remains context, not overlap.

    Verdict unchanged: valid, stays open. Prior sharpening stands: one shared close-on-popstate hook over four sites, LIFO entries for stacked overlays, and an outcome-based Verification anchor (assert the overlay closes on popstate, no stray entry on Esc/X).

  4. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Closing as not planned. Wiring overlays into browser history adds history entries the app otherwise doesn't keep, and that has its own edge cases.

    On a phone, close the lightbox and dialogs with their X button, and leave History with Back to chat.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions