Skip to content

Reader toolbar fits phones: history and Review move into a More menu, Go to becomes an icon - #22

Merged
Kevin-Taha merged 4 commits into
mainfrom
copilot/make-reader-work-on-narrow-layouts
Nov 14, 2026
Merged

Kevin-Taha merged 4 commits into
mainfrom
copilot/make-reader-work-on-narrow-layouts

Conversation

@Kevin-Taha

@Kevin-Taha Kevin-Taha commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

On phones the reader toolbar doesn't fit. At 390px the Go to button squeezes to 34px and its G hint covers the page field. At 320px the toolbar is 356px wide and gets clipped. This PR covers the "toolbar that fits" part of the narrow-layouts work. The note rail, responsive margin and overlay sidebar were already in place.

All changes apply only at max-width: 600px, the phone breakpoint the library and settings screens already use. Screenshots at 1440, 1280, 1180, 820 and 601px are byte-identical to main. At 820px the toolbar already fit: the 868px overflow reported in the issue comes from hidden tooltip ::after elements, not from the toolbar.

Changes

  • ToolbarMore.tsx (new): a More menu holding Back, Forward and Review notes, each 44px tall.

    • Back and Forward name their target page ("Back to p. 1") and are disabled when there's nothing to go back or forward to.
    • Review notes shows the note count.
    • Items keep their aria-keyshortcuts.
    • Choosing an item closes the menu and puts focus back on the More button.
  • Esc handling: Esc is caught by a capture-phase keydown listener on document that calls stopPropagation, the same approach as AppearanceMenu. Safari doesn't focus a tapped button, so a handler on the menu's wrapper never receives the key. Esc would then reach the app-wide dismiss shortcut, which hides the Return pill or exits focus mode, and the menu would stay open.

    // Captured on the document: Safari doesn't focus a tapped button, so focus may be anywhere.
    document.addEventListener('keydown', onKeyDown, true);
  • ReaderView.tsx: HistoryButtons is wrapped in .reader__history (display: contents, so desktop layout is unchanged) so CSS can hide it. Adds an openReview callback that the toolbar Review button and the More menu both use.

  • reader.css: below 600px:

    • Hide the history buttons, the Review button, the section name, the Go to G hint, and the (N of M) total next to printed page labels.
    • Show the More menu.
    • Turn the Go to heading into a 34px icon button.

    Hiding the page-label total is needed: books with printed labels still overflowed at 320px without it.

Tests and docs

  • e2e/narrow.spec.ts: a new expectToolbarFits helper checks that every visible toolbar control is inside the window and doesn't overlap its neighbour. Two phone tests:
    • At 390px:
      • The Go to icon opens the palette.
      • The More menu's history and Review items work.
      • Tapping outside closes the menu.
      • Esc closes it with focus left elsewhere (as in Safari) and the Return pill stays visible.
    • At 320px with a book that has printed page labels, the toolbar fits.
  • DESIGN.md §5.2 describes the phone toolbar. ROADMAP.md now lists only pinch-to-zoom and touch selection as remaining.

Not included

  • Pinch-to-zoom and long-press selection (PR 4 in the issue).
  • env(safe-area-inset-*): it needs viewport-fit=cover plus padding on every screen, not just the reader.
  • Separate phone/tablet Playwright projects: the narrow specs set their own viewports and run in the existing project.

@Kevin-Taha Kevin-Taha changed the title [WIP] Make the reader work on tablets and phones Reader toolbar fits phones: history and Review move into a More menu, Go to becomes an icon Nov 14, 2026
- Replace wrapper onBlur with document focusin so Safari's null-target blur on button mousedown and taps on disabled items don't swallow or close the menu, while shortcuts moving focus elsewhere still dismiss it
- Close More and move focus off its hidden subtree when widening past 600px so Esc and focus-mode toolbar auto-hide aren't stuck
- Tighten the <=600px toolbar grid tracks and gap so 4-digit unlabelled page counts fit at 320px without overlapping Go to, and cap/truncate long printed labels inside More

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: b1393a3b-8b09-49e5-aa20-78201068a159
@Kevin-Taha
Kevin-Taha marked this pull request as ready for review November 14, 2026 20:41
@Kevin-Taha
Kevin-Taha merged commit b681545 into main Nov 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the reader work on tablets and phones (narrow layouts)

2 participants