← Back to Pull requests

feat(reader): the reader under a finger: a bar of four, every menu one sheet, 44 px targets, the page read out, a double tap that fits the text, the pinch one transform committed at the lift #726

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 30, 2026 13:46 UTC
Author

The PDF reader under a finger, one batch: the owner's review of the reader on his iPhone (2026-11-30: "The adaptation to mobile is not enough: it has not reached an excellent UX design"), the direction he approved that day with its three removals on a phone (the zoom percentage and its menu; typing a page number; the arXiv link out of the bar, the last a host's own slot), and the pinch rebuilt after his two screen recordings showed it stuttering. He tried the rebuilt pinch on his own phone ("much smoother") and approved the whole as shown on staging. Each rule red first, then its fix, a commit of its own, with its section of docs/PDF-READER.md.

The rules behind it

  • Touch is the primary pointer being a finger, CSS pointer: coarse (in script the kit's one reading of it, @readarxiv/ui coarsePointer, read when asked and never kept; MenuList and the kit's Popover follow it as it changes). No device, no browser's name, no window size is asked.

  • How a control is presented and hit follows the pointer; what the bar holds follows the room, by the width rules the sheets already had (§5). The narrow rule (840 px) is unchanged.

  • A fine pointer keeps today's interface. The bar's boxes and hit areas at 360, 393 and 412 px, the options' rows and controls and the page pill were compared row by row, the line against the bar's commits, in Chromium, WebKit and Firefox: identical; the fine pointer's rows below stand green on the whole. The one thing that changes there: the toolbar's zoom value now updates when a trackpad's pinch ends, not at each step (a step tells the chrome nothing, §6.8).
  • What a reader on a phone gets

  • A bar of four (§5, §6.1, §6.2): the zoom value and its menu are not drawn under a finger (the pinch and the double tap are the zoom there; a fixed percentage means nothing on a screen of unknown width), nor a display the host greys (its reason is a hover's tooltip, which a finger never sees: a dead 40 px on every phone). From 360 to 500 px the bar holds the way home, the contents, a host's slots, the switch of the two displays the window shows and the options.

  • Every menu is one bottom sheet (§6.7): the reading options, the language lists, the extension's service and download menus and whatever a host opens through the kit's Popover in the chrome open as the sheet the link previews already are (.axt-sheet: a native modal dialog from the window's foot, its safe area kept), rows 44 px. One sheet at a time: the options' language row replaces them with the list, a pick closes it, the focus goes back to the options' button. A page that gives the kit no sheet (the extension's popup and settings page) keeps its popovers.

  • A tap on a sheet's backdrop acts on nothing under it, the menus' and the previews' alike, by one function (packages/ui/src/controls/backdrop.ts closeOnBackdrop): the dialog takes its backdrop's click and closes. Not closedby="any": Chromium, Firefox and WebKit close the dialog on the pointer's release, before the click, which then landed on the link under it (a tap beside the options opened a citation's preview; a tap on a preview sheet's backdrop over another citation opened that citation's sheet).

  • Every target 44 px, its drawing kept (§6.1 to §6.5): one @media (pointer: coarse) block in reader.css and one in the kit's controls.css, each hit area a pseudo-element, 14 px between the bar's controls so that none meets another. Before: the bar's buttons 34 × 44, the segments 40 × 27, the menus' rows 30, the swatches 17, the pill's arrows 24. Now every target of the bar 44 × 44 or more at 360, 393 and 412 px, none over another, none outside the window; the options' controls likewise but the appearance's middle segment (36 × 44: a segmented control's segments touch) and the capsule's action and close (34 tall: the capsule clips what it holds for its motion).

  • The page number is a readout, the edge's handle the travel (§6.4, §6.5): the pill reads "10 / 163" with the way back when there is one, its arrows and its field not drawn, nothing in it that does nothing taking the focus. The scroll indicator's thumb is a 44 px handle while the pane scrolls, dragged by a finger from the first page to the last, the page it stands at read beside it (digits alone); at rest it takes no touch and the pane's edge scrolls the page.

  • A double tap fits the text block under the finger, and back (§6.8): max(the page fit, min(1, (the pane − 40) / B)), B the measure TeX set the line in (format's Line m0..m1, never its ink), so that a heading or a one-line paragraph fits its column; a second double tap goes to the page fit. Read from touch events (zoom-gesture.ts readDoubleTap) with Android's interval and slops (AOSP ViewConfiguration), every listener passive and none for touchmove; a double tap whose first tap acted (a link, a control) zooms nothing. After a rotation, a resize or a display chosen, the paper is fitted by its text's width, never under its page fit: at 393 px a letter page with a 396 pt block reads at 67 % (its 10 pt line at 8.9 CSS px) where its page fit stands at 43 %.

  • The pinch is one transform on one layer, committed once at the lift (§6.8, the technique of the open-source EmbedPDF viewer, MIT; no code taken): from the second finger down until they lift the gesture is the reader's alone (a blocking touchmove added at the second touchstart only, each move's default prevented; one finger stays the browser's, its scroll and momentum meeting nothing blocking). Each frame writes one style on one element a pane, transform: translate(…) scale(k) on its pages' stack, k the fingers' own factor, never rounded (a step rounded to PDF.js's hundredth had held the picture for two to four frames at a phone's 57 %: the plateaus of the recordings). Nothing else is written: no scroll, no layout read, no scale told, nothing drawn. At the lift one commit: the transform off, the scale written once on the hundredth PDF.js keeps, the scroll put so that the held point stands where the preview showed it. One preview for the wheel, two fingers and the double tap: the old two-mode preview, its per-page offsets and its scroll-following are gone.

  • A touch is followed on its own element (§6.8, zoom-gesture.ts followTouches): a touch's events go to the element it came down on for its whole life, even once that element has left the document (Touch Events, Touch.target), and then no ancestor hears them; a page laid or drawn again under resting fingers (the translation's page over the original's) had taken the rest of their gesture, its end included, leaving the stack transformed. Every touch the reader reads is now followed on that element and on the document, each event told once, and a finger the platform's own list no longer holds has lifted. A preview never outlives its gesture (settle).
  • Tests, red first

    Harness rows (the reader package's harness), each red on the code before its rule and green after; real touches where a touch is the point (Chromium's own through CDP; WebKit with an iPhone 15's descriptor and Chromium with a Pixel 7's; Firefox in a window of the iPhone's size with a touch screen, its primary pointer coarse):

  • finger: … (13): the bar on a coarse and a fine pointer at 360, 393 and 412 px; the options as one sheet, a tap on its backdrop over a link opening nothing; the language row replacing the options, a pick closing it; the fine pointer's popover as before; every target of the bar, the options' sheet, the pill's way back and the capsule at 44 or more; the pill read out at pages 9, 10 and 100 with the way back on one line, and kept with its arrows and field on a fine pointer; the thumb a 44 px handle, dragged from the first page to the last with its page read; a tap on the backdrop of a link's preview sheet, over another citation, closes the sheet and opens nothing (red in the three engines: the second citation's sheet opened).

  • fit: … (7) and tap: … (4): the open at the page fit while the text is unknown, as today on a fine pointer and at 1180 px; a rotation fitting the text again; a two-finger pan keeping the fit; a double tap fitting the column about the finger, a second the page, a third the column; a double tap on a link zooming nothing; a double tap whose first tap's element is replaced; the pane's edges while the double tap moves (a reading); the open's cost (a reading: no second draw, page 1 drawn as often as on a fine pointer).

  • pinch one: … (7), by structure, never by a tuned time, over a 24-page fixture (s7-long): two fingers in and out at a phone's text fit, resting 300 ms and moving on, and a trackpad's pinch in and out over both panes: the scroll never moves, style is written on exactly one element a pane, its transform moves in every frame an input came in, no canvas is added and no scale written until the lift (the old code: the scroll moved, 19 elements written, the scale committed under resting fingers, 8 canvases drawn); then one commit, the point held within 0.82 px, no frame showing ground where a page was. The main thread's time a step and the commit's (readings).

  • touch: … round 2 (7) and its double tap: the element under the first finger removed or copied while two fingers zoom; two fingers resting while the translation's page is laid over the original's; the element removed and the touch cancelled; an end that never reaches the reader; the panes swapped under the fingers; one finger's tap after such a gesture. On the code before: 0 of 14 and 0 of 12 moves followed, no commit, the stack left at 1.525 and 1.375; the cancel lost; the swap's preview going on and committed twice. After: every move followed, one commit, nothing left on the stack. #724's touch: … rows stand green on the new preview, "a pinch over the page pill or the scroll indicator's shown thumb zooms nothing" among them.

  • Unit rows: panes-fit.test.ts (the two scales, the block under a point, the text's extent), zoom-gesture.test.ts (the double tap's reading, a removed target's moves and end, a finger the platform no longer lists), chrome/pinch.test.ts (the wheel's path alone), display-switch.test.ts, scroll-indicator.test.ts, the kit's popover.test.ts (the sheet: modal, put in the host's element, one at a time, its backdrop's click its own, the focus a tap's sheet holds), preview/sheet.test.ts (no closedby, its backdrop's click its own).
  • Measured

  • The pinch's step and commit (the harness, Chromium, s7-long at a phone's text fit, the main thread's task time a frame over the gesture): 2.4 ms at 1x CPU, 3.5 at 4x, 5.0 at 6x, within a 120 Hz frame's 8.3 ms; the old preview's 2.5 and 6.0 at 1x and 4x on the same rows. The commit's task 10 to 18 ms, once, at the lift. Script a frame 0.2 to 0.3 ms.

  • The commit lands on the scale's hundredth about the held point: the point within 0.82 px (two fingers in, ×2.5) and 0.28 px (out, ×0.46); its neighbours move at the commit by the gaps the preview scaled with the pages ((k − 1) × the gap: ±24 px in, about ±10 out), the held page by none.

  • The text's width T (§6.8): over 529 papers' bundles of our test corpus with TeX's measures, page 1's extent is the paper's median page's within 1 pt in 520, never narrower, wider in 4 (a table's cells past the block, 1 to 7 pt).

  • The open on touch (a reading, one run each on a shared machine): page 1 drawn three times on a coarse pointer and three on a fine one (no second draw at the open); its first draw at 122 and 124 ms at 1x CPU, 392 and 348 at 4x.
  • What only a real phone can confirm

    That iOS Safari and Firefox for Android send a removed target's touches to it or to the document as Chromium and WebKit do, and that a touchmove listener added at the second touchstart blocks from the next move there; the pinch's frames on the device (the owner's own phone found it much smoother); that iOS Safari and Firefox for Android deliver the double tap the reader reads from touch events (Playwright's WebKit sends touch events alone for its taps, its Firefox no touch screen); the 44 px targets under a thumb.

    Not in this

  • The paper at its text's width at the first open: the panes lay the pages before any part of the layer is read, so a first open stands at the page fit and the text fit lands at the next fit (a rotation, a resize, a display chosen).

  • The bar stepping aside while reading (a second batch).

  • A phone held sideways: the narrow rule (840 px) is unchanged.

  • A host's own changes: its menus' rows at 44 px inside a sheet (.pop[data-sheet]), its menus closed by the kit's shut (a sheet's hidePopover() throws), 14 px between its controls in the bar, its arXiv link moved into the options below 500 px, and the chrome's pinch action now taking (side, factor, at) with no from.
  • Checked

    On the branch's head before its last commit (documents only), each by its exit code: pnpm typecheck 0, pnpm lint 0, the census 0 (21 held, 0 rose: productCode +412, productModules +3, budgetsUnmeasured +1 for the double tap's 240 ms motion, tenLongest +97, recorded with their reasons), pnpm test 0 (14,132 passed) and its hosted-CI form 0, pnpm build 0, pnpm e2e:reader 0 (105/105), pnpm e2e:framing 0 (22/22), the reader package's harness in its two parts 0 (255/255, then the tables 2/2), and the phone rows in WebKit (21/21) and Firefox (14/14). On the head: pnpm lint, pnpm typecheck and the census again, 0. No version moves (PIPELINE, LAYOUT, TRANSLATE, FORMAT): the reader's interface alone. e2e:popup not run (it reaches the network); the kit's sheet changes nothing in the popup, which gives no sheet.

    🤖 Generated with Claude Code

    <!-- devin-review-badge-begin -->

    ---

    <a href="https://app.devin.ai/review/srjoeee/readarxiv/pull/726" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
    <!-- devin-review-badge-end -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: devin-ai-integration[bot] Review duration: 12m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 78% · Reviewer familiarity: 35%
    41%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #726"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 41.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 41.4% · Lower = rushed or shallow review
    41.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 30.5% · Safe to merge
    30.5%