Repository navigation
Navigate back and forward through internal PDF links - #57
itaysabato wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fd0f37e49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (e.altKey && !mod && !e.shiftKey && (e.key === "ArrowLeft" || e.key === "ArrowRight") | ||
| && !typing && !document.querySelector('[aria-modal="true"]') && !pending && !imageView) { |
There was a problem hiding this comment.
Prevent native history in excluded Back/Forward contexts
In the Windows/Linux browser build, Alt+Left and Alt+Right are also Chromium's native history commands. Because preventDefault() is reached only after the !typing and no-modal tests, focusing a page/search field or opening an aria-modal dialog lets the default action run, so the joint browser history can unload the reader rather than leaving that control alone as README.md:68 promises. Suppress the native default in those excluded contexts without taking away macOS Option-word movement.
AGENTS.md reference: AGENTS.md:L3-L3
Useful? React with 👍 / 👎.
Problem
Following an internal PDF link or an outline entry loses the previous reading location. Folio has previous/next page controls, but no link history for returning from a footnote, reference, figure or appendix.
Change
Add Back and Forward buttons and Alt+Left / Alt+Right shortcuts (Option+Left / Option+Right on macOS). Each document keeps its own bounded in-memory history, restoring PDF coordinates, zoom and rotation. Following another link after Back replaces the forward branch. PDF GoBack/GoForward actions use the same history.
Shortcuts leave editable fields and modal dialogs alone. History is reset when a document is replaced and is never shared between tabs or written to browser navigation history. Update the in-app shortcut guide and README.
Issue or approval
Closes #59.
This is a feature proposal. Contributor review is complete and the feature is approved for maintainer review. Maintainer agreement on the idea and scope, required by CONTRIBUTING.md for features, is still pending in the linked issue. The implementation is already available here for review.
How I checked it
On macOS, TypeScript, production build, 18 chat-math regressions, the existing network/Word/release tests, seven focused history tests, reader-security regressions, and the full off-screen smoke suite pass.
Real PDF fixtures cover named and same-page links, outline destinations, PDF GoBack/GoForward actions, keyboard and toolbar traversal, restored zoom and horizontal/vertical reading position, forward-branch replacement, separate tabs, editable fields, modal dialogs and a 420px viewport. Focused tests also cover loading destinations, invalid targets, document reset, rotation and the 100-entry history limit.
Windows, macOS and Linux CI passed all three platforms on the exact PR head (
8fd0f37). Upstream CI requires maintainer approval for this fork contribution. The two PRs also merge cleanly and pass the full macOS smoke suite together in a disposable integration checkout.Before — the navigation bar has page and zoom controls.
After — separate Back and Forward arrows appear before the page controls. Both screenshots use Folio's sample document on macOS at the same window size.
Implemented with GPT-6 in Codex Desktop.