Repository navigation
Add page navigation to PDF previews #334
Description
Add page navigation to PDF previews
Important
Problem — PDF previews provide continuous scrolling and zoom, but researchers cannot identify the current document page or move directly between pages.
Approach — Preserve the continuous, selectable multi-page viewer. Add a PDF-only page navigator immediately left of the zoom control: a stacked previous/next stepper followed by a current / total counter. The counter follows the rendered page nearest the viewport center; page actions smoothly scroll the adjacent page to the viewport top.
Scope — In: PDF Preview navigation, page status, accessible control states, and regression coverage. Out: single-page rendering, direct page-number entry, shortcuts, and non-PDF previews.
Assumptions — The current viewer retains rendered page anchors and can observe their position in the Preview scroll container.
Acceptance Criteria
- A loaded PDF displays an outlined page navigator immediately left of the zoom pill, with a stacked previous/next stepper and a
current / totalcounter. - Manual scrolling reports the rendered page nearest the viewport center.
- When two pages are equally near the viewport center, the lower-numbered page remains current.
- Previous and next smoothly scroll the adjacent page so its top is at the viewport top.
- Previous is disabled on page 1 and next is disabled on the final page; either action is also disabled until its target page anchor is available.
- A one-page document displays
1 / 1with both navigation actions disabled. - The navigator is absent until the PDF page count is known and remains absent if PDF rendering fails.
- Navigation preserves continuous scrolling, text selection, zoom behavior, and pane-local control visibility.
- Icon controls have accessible names, visible focus, keyboard operation, and legible disabled states in light and dark themes; the current page status is announced politely when it changes.
Testing Decisions
Extend the existing Preview browser regression suite with a multi-page PDF fixture. Cover initial page status, a geometry assertion that the navigator precedes zoom without scroll-rail collision, adjacent-page navigation, manual-scroll updates, boundary and unavailable-target disabled states, and the one-page state. Retain the current PDF selection and zoom regressions as compatibility coverage.
Key Decisions
- Continuous scroll remains the viewer model; this feature navigates already-rendered pages rather than introducing a single-page viewer.
- The PDF renderer owns page-anchor discovery and active-page observation. The Preview control host displays that state and requests a page movement.
- The control uses the current Preview auto-hide lifecycle and existing tokenized control and icon conventions.
Constraints & Invariants
- No global, workspace, or tab-level page state is introduced.
- The page status never renders before a page count is known.
- A missing page anchor disables the corresponding navigation action rather than advancing the status optimistically.
- Page navigation does not replace the existing PDF error state.
Prior Art
- Existing PDF canvas renderer and Preview control group.
- Existing Preview zoom, text-selection, and scroll-rail regression contracts.
Source
Brainstorming session, 2026-09-10.
Notes
Single standard-slice UI feature. No ADR or sub-issue decomposition is warranted.
Activity