Skip to content

Let a link to another saved page open in the reader — today it blanks the HTML pane it was clicked in #220

Closed as not planned

Description

@bencode

Problem

framePage prepares an HTML page for its sandboxed frame in three moves (ui-packages/web/src/features/reader/html-page.ts:35-68): the images it names are resolved from the library against the page's folder, web links get target="_blank", and #fragment links get a scroll handler. A link naming another file of the library — chapter-2.html, ./sub/report.pdf, ../index.html — matches none of the three: only /^https?:\/\//i and # are considered (lines 49-52), so the href is left as written.

In the frame it then kills the pane. The page runs from a blob URL in a sandbox without top navigation (ui-packages/web/src/features/reader/html-reader.tsx:25-31), so the click navigates the frame itself to blob:…/chapter-2.html, which cannot resolve: a blank pane until the tab is reopened — the dead pane #204 described for web links, back through the door #218 left shut.

A reader meets this with ordinary imports: a folder of saved pages — documentation, an offline copy of a site — where every page links its siblings. And the failure is lopsided inside one page: its <img src="images/fig.gif"> renders fine, because image references already resolve through the library (ui-packages/web/src/features/reader/markdown-image-resolver.ts:8-23), while its <a href="chapter-2.html"> blanks the pane. Notes open the files they link (ui-packages/web/src/features/reader/markdown-reader/file-link.tsx); an HTML page is the only place a library file link leads nowhere.

Proposal

  • In framePage, resolve each non-web, non-fragment href against the page's folder with the same resolveFileReferencePath the image resolver uses.
  • An href that names a library file opens that file in the reader, in a tab, as a note's file link does — the frame hands the target to the app, the shape the existing sandbox (scripts, popups) already allows.
  • An href that resolves to nothing in the library does nothing, but must not navigate the frame — the pane never dies on a link again.

Goal

After this, a reader who imports a folder of linked pages moves between them by the pages' own links, each opening in a tab as a note's link does; and no link inside an HTML page can blank the pane it was clicked in.

Verification

grep -q "resolveFileReferencePath" ui-packages/web/src/features/reader/html-page.ts
pnpm --filter -reader/web test --silent -- src/features/reader/html-page.test.ts
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 26, 2026
  2. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@e011712 (2026-10-26, i.e. after #218).

    Evidence audit: all citations hold.

    Sensor + Verification block repaired (logged here per policy): lint ✓ — but verify ✓ passed on unmodified main, i.e. a false pass: the block runs the existing html-page.test.ts and pnpm check, both green with the deliverable absent (resolveFileReferencePath appears nowhere in html-page.ts). Since verify is the close gate, a future beat could have read this as implemented. Prepended the deliverable-shaped anchor:

    grep -q "resolveFileReferencePath" ui-packages/web/src/features/reader/html-page.ts

    Re-linted ✓; verify now ✗ on main for the right reason (fails fast).

    Sharpening: the load-bearing invariant is "no link can blank the pane" — an href that resolves to nothing in the library must have its click swallowed inside the frame, not merely left unrewritten (a left-as-written href still navigates the blob frame and kills it). That swallow belongs in the injected in-frame script alongside the # handler, and it is the case html-page.test.ts should pin. Sibling forms (./, ../, bare name) should flow through the one resolveFileReferencePath call; non-HTML targets (a notes.md href) should open through the same open-file path a note's link uses, not be special-cased.

    Verdict: valid — stays open.

  3. bencode commented on Oct 27, 2026

    @bencode
    OwnerAuthor

    Closing. The page runs from a blob URL, and a relative href such as chapter-2.html cannot be resolved against one (new URL throws), so the browser does not navigate: the link does nothing rather than blanking the pane. Opening linked library files from a page would need a script in the frame and a message channel to the app, which a folder of interlinked saved pages, a rare import, does not justify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions