fix(notes): restore page navigation on inline PDF embeds - #902
Merged
Conversation
The chromeless embed rework (#763) pinned the inline PDF preview to `pageNumber={1}` and deleted the page controls along with the rest of the chrome. That shipped in v2026-07-19.2, where it reads as a bug: a dropped multi-page PDF renders its first page with no way to reach the others. Bring paging back without giving up the chrome-free look. `numPages` and `currentPage` are tracked again and the page renders `currentPage`; the controls are a bottom-centered pill that only appears on hover or focus, and only exists when the document actually has more than one page, so single-page embeds stay exactly as they are. The current page is view state, not a block prop, so the `<!-- file:{...} -->` marker is untouched and existing notes stay byte-identical on re-save. Placement dodges the two overlays already on the card: the resize brackets at the bottom corners and the alignment toolbar at the top-inline-end. The pill is centred with `inset-x-0` + `justify-center` rather than a translate so it is RTL-safe, the chevrons flip with `rtl:rotate-180`, and it sits at `z-10` to clear react-pdf's text layer (`z-index: 2`), which otherwise swallows the clicks.
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A user on v2026-07-19.2 reported dropping a PDF into a note and getting the first page with no way to reach the others. That is a regression from #763: the chromeless embed rework pinned the inline preview to
pageNumber={1}and deleted the page controls along with the header, footer and thumbnail sidebar.git tag --contains 388daf447confirms it went out in v2026-07-17 through v2026-07-19.2, andfile-block.tsxhas not been touched since, so it is still live onmain.This restores paging without giving up the chrome-free look:
numPages/currentPageare tracked again and the page renderscurrentPage.[‹] 1 / 12 [›]pill that appears only on hover or keyboard focus, and only renders whennumPages > 1— single-page embeds stay exactly as they are today.<!-- file:{...} -->marker is untouched and serialization is unchanged, so existing notes stay byte-identical on re-save. No migration or compat concern.Note that the full-file viewer (
components/viewers/pdf-viewer.tsx, also used by comment attachments since #829) is a separate component and always kept its arrows, counter and sidebar. Only the note embed lost them.Reviewer notes
Three constraints shaped the placement, all previously learned the hard way on this card:
z-10. react-pdf's.react-pdf__Page__textContentisz-index: 2and silently swallows clicks on anything below it.pointer-events-none absolute inset-x-0 bottom-2 flex justify-centerplus apointer-events-autoinner pill, rather thanstart-1/2+rtl:translate-x-1/2. This keeps it RTL-safe without a translate, and leaves the page selectable underneath. Chevron glyphs flip viartl:rotate-180.-bottom-1 -start/-end-1) and the alignment toolbar ownstop-2 end-2.Release note
Multi-page PDFs embedded in a note can be paged through again — hover the embed for page controls.
Test plan
file-blockunit tests — 7 passed, 0 failed (2 new: paging through a multi-page PDF, and single-page PDFs staying chromeless). Both were red before the fix on the missingpreviousPagecontrol.pnpm --filter @memry/desktop typecheck:web— clean.eslint --no-cacheon the changed component — 0 errors, 0 warnings.pnpm --filter @memry/desktop i18n:check— passed (newpreviousPage/nextPagekeys).pnpm docs:impact --base origin/main --strict— no docs-relevant changes.prettier --check,git diff --check— clean.Not covered: no E2E. The existing
tests/e2e/pdf-embed-resize.e2e.tsfixture is a single-page PDF, and a paging test needs a new multi-page fixture with a byte-correct xref or pdfjs refuses to load it. Happy to add one if it is wanted before merge.