Skip to content

Navigate back and forward through internal PDF links - #57

Open
itaysabato wants to merge 1 commit into
Forward-Future:mainfrom
itaysabato:ci/internal-link-history
Open

itaysabato wants to merge 1 commit into
Forward-Future:mainfrom
itaysabato:ci/internal-link-history

Conversation

@itaysabato

@itaysabato itaysabato commented Nov 4, 2026 •

Copy link
Copy Markdown

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.

Navigation bar before this change

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.

Navigation bar with Back and Forward

Implemented with GPT-6 in Codex Desktop.

@itaysabato
itaysabato marked this pull request as ready for review November 4, 2026 15:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T15:38:37.662485Z 8fd0f37 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/App.tsx
Comment on lines +1038 to +1039
if (e.altKey && !mod && !e.shiftKey && (e.key === "ArrowLeft" || e.key === "ArrowRight")
&& !typing && !document.querySelector('[aria-modal="true"]') && !pending && !imageView) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

This branch has not been deployed

No deployments
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.

Go back and forward after following internal PDF links

1 participant