Skip to content

[experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame - #12373

Closed
josephfarina wants to merge 8 commits into
mainfrom
josephfarina/rl-fragment-links
Closed

josephfarina wants to merge 8 commits into
mainfrom
josephfarina/rl-fragment-links

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

In a viewer that shows a rendered file in a frame given its document inline (srcdoc), as many artifact viewers do, every link to a place in the page (<a href="#section">, a filter chip that sets the hash) took the reader away: the frame navigated to the viewer's own page and the rendered page vanished.

Some viewers cancel such a link themselves on its way down, from a listener their own script adds on the frame's window before the file's script runs or on its document from a DOMContentLoaded listener their script adds on the frame's document before the file's script runs, and only scroll to the place, leaving the frame's address as it is. There a page that switches tabs or views on its address (a hash-routed app) never sees the click, so its tabs and navigation do nothing.

Problem and solution fit

  1. Why it occurs: in a srcdoc frame the document's base address is the viewer's page, so #section resolves against it, and following the link loads that page in the frame.
  2. Why it harms the task: in-page navigation (a table of contents, section chips, hash-routed views) is common in shared pages, and the click destroys the page.
  3. Why that matters: a rendered file must work in a viewer as it works in a browser tab.

The file's viewer handling now takes a click on a link whose written href starts with # (no target, no download, the primary button, no modifier keys), only when the document's base address differs from its own address, as in a srcdoc frame. It cancels that navigation and lets the browser move to the place itself, against the frame's own address: it moves to a new place by assigning the frame's own address with that fragment (adding a history entry, as a tab does), and replaces the address only for a repeat click on the current place, so it stays a fragment move. So scroll, :target, hashchange and focus behave exactly as in a browser tab, encoded ids and links that name no element included. The decision runs after every listener the page adds for that click, on the document or the window, also one added after the file's script, so a link the page handles itself keeps its way. When the page stops the click's propagation (a link inside a clickable card), the file holds the browser's own navigation at that point and decides after the click's handlers have run: it moves unless the page cancelled the click, by preventDefault(), by an onclick that returns false, or by returnValue = false. A file opened from disk or from a real address is unchanged.

The move runs in the script's first module, before any of the page's own modules. A cancel counts as the viewer's only when it is made on the click's way down by a listener the viewer's own script added: one on the frame's window that already cancelled the click when the file's window listener runs, or one on the document that runs before the file's marker there. The file puts that marker on the document once the frame's document has loaded (at once if it already has), because an artifact viewer's frame script adds its own document listener only then, after the file's script ran; the marker then comes after the viewer's listener and before the listeners the page adds once it is mounted. A click listener the page adds on the document or the window while the document loads (from its modules, an import() or a promise callback; the window ends at a capture DOMContentLoaded listener the file adds on the window, which runs before a DOMContentLoaded listener a viewer adds on the document; a viewer that listens for DOMContentLoaded on the window is not covered) is marked as the page's while it runs, so a cancel it makes keeps the page's way even though it comes before the file's document marker. Only click is wrapped, with one wrapper per handler: once a handler has one, every later click add and remove of it uses that wrapper, so a handler added at load and again once mounted registers once, and removing a handler for another event type removes it as in a tab. Then the viewer holds the browser's own move, and the file still moves, so a page that routes on its address sees the new place. A cancel by any of the page's own listeners (capture or bubble, on an element, the document or the window; preventDefault, a falsy returnValue, or an onclick that returns false) keeps the page where it is. A bubble-phase viewer listener is read as the page's and keeps the page's way; no viewer is known to need it. The viewer's hold and a page handler that stops the click are tracked apart, so a link in a card that stops the click still moves in such a viewer.

Expected behavior and authority

astryx experimental export is experimental (spec:AST-017 FR27). The maintainers decided that the file works in a viewer's frame as in the app (the existing link and form handling).

Smallest restoration

  • foundation/render/client-bundle.mjs: the in-page link case in the viewer handling.
  • A changeset.

Evidence

  • api/render/render.interactive.test.mjs (JSDOM, a srcdoc document with a viewer base address): every in-page link stays in the frame (about:srcdoc#…) and fires hashchange (the page's hash readout updates); a first click on # and repeat clicks stay fragment moves; encoded (#café → #caf%C3%A9) and non-encoded (#100%) ids; a page listener on the document or the window cancels the move; a link the page handles itself keeps its way.; a React link that stops propagation inside a clickable card still moves, and the card does not hear it; links that stop and return false or set returnValue = false stay put; a first # adds one history entry. The test fails on the base.

  • In Chromium, a frozen set of five in-page link pages in a sandboxed srcdoc frame (a table of contents with raw links, Core's Link, #, a missing id and a back link; a hash router with hashchange views and history.back(); :target panels), with repeat clicks on the same link after scrolling back, plus a page whose ids hold spaces, non-ASCII letters, %, ? and an emoji (raw and encoded links, and Core's Link): 6 of 6 now behave exactly as the same page in a top-level tab (2 of 6 before, the two controls): same hash, view and target, same document, no console errors. The two control pages (toggle chips, a Switch and a SegmentedControl; links that cancel their own click) still pass, and a modifier click opens a tab as it does at top level.

  • In Chromium, the file's script in a sandboxed srcdoc frame matches the same page in a tab, for focus, scroll, hash and the next Tab, on all 11 steps (a first click on # after typing into an input keeps the typed text): a target that takes no focus, a tabindex="-1" target clicked twice, an element whose id is top, a link to #q with only an <input name="q">, an <a name> anchor, an encoded #café, a missing id, and a repeat "Back". With a clickable card around the links, stopping propagation, stopping and cancelling, cancelBubble, stopping and returning false, stopping and setting returnValue, a script click() that stops (with and without return false), a first # (one new history entry) and Back all match a tab too (10 of 10).

  • Interaction parity on a frozen set of pages with in-page links (a table of contents with its "Back to top" focus, :target filters, Core's Link to #fixes and to #top with no such id, a long document's table of contents) in a sandboxed frame: 4 of 4 match the app (0 of 4 before); the control pages pass as before.

  • On a frozen set of 3,935 generated cases, results are the same as main (2,245 of 2,448 pages pass on both), with no page changing from working to broken.

Scope

  • One defect is restored.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run --project node packages/cli/api/render packages/cli/foundation/render.
  • .github/scripts/render-interaction-parity.browser.test.mjs: a hash-routed page in Chromium, in a sandboxed srcdoc frame under the viewer policy, with and without a host script that cancels every # link at the document and only scrolls. Home, Members and Settings switch in both; a link the page cancels itself stays. Without this change the case with the host script stays on the first page.
  • The same browser case also runs with a host that adds its document listener at DOMContentLoaded, as an artifact viewer's frame script does; it fails on the previous head (frame stays on Home) and passes here.
  • The routes page also has a link its module cancels from a document capture listener it adds while it loads (FAQ, opening its own panel): it keeps the page's way in every frame. It fails on the previous head, where the frame moved to #faq.
  • The routes page also has a link a module loaded with import() cancels (Lazy): it keeps the page's way in every frame. A new case, registers the page's own click and key handlers as a browser tab does, checks that a handler added at load and again in an Effect counts once per click, and that a handler added for click and keydown that removes itself from both runs once for two keys. Both fail on the previous head (unlocks 2; the frame moves on Lazy) and pass here.

Preflight (astracat preflight 2026-11-18.4, CI half): lint, build, typecheck and the test-ui checks pass. The full node suite reported 6 failures in 4 files: setup-workspace (fixture install) fails the same way with this PR's script swapped back to the merge base, and offline-media, packed-gather-cache.records and handoff.e2e pass alone with this head (48 passed). Review half: its two findings (viewers that listen for DOMContentLoaded on the window) are answered by narrowing the release note and this description to a viewer's document listener, which is what an artifact viewer's frame script does.

Preflight note: this PR predates the preflight rule, so astracat's review and the batch run are its gates. The CI half ran on c0fbe9b (runtime identical to this head apart from comments inside the move script): every check passed except env-only node failures (setup-workspace fixture install and packed-gather-cache.records fail the same way at the merge base; handoff.e2e and offline-media's real-browser cases pass alone). The review half's two findings are answered at this head by narrowing the release note and this description.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 19, 2026 3:47am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 3:59 AM UTC

@josephfarina
josephfarina marked this pull request as ready for review November 17, 2026 17:40
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 908d70e

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.46 MB packed (+4.1 kB); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: 0 job-min per update · pool 0% · standard runners · 1 CI action or script file changed (not measured)
Before After Change
Job-minutes per PR update 172.6 172.6 0
Runner pool, runner-minutes a day 51,495 51,495 0 (0%)
Average concurrent jobs 35.8 35.8 0
Time to green (median → this run) 27.8 min — —
Runs a day 298 298 0

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/render-interaction-parity.browser.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: a click on an in-page link now stays in the file in a srcdoc viewer frame, but a second click on the same link still does nothing.

  • A repeat click on the same in-page link does nothing in a srcdoc frame, because location.hash = href.slice(1) (packages/cli/foundation/render/client-bundle.mjs:68) is a no-op when the hash already has that value, so when it matches, scroll to the place directly (the element with that id, or the top for # and #top) and add the repeat click to the test.

In Chromium, a second click on a table-of-contents link after scrolling away, or a second Back to top click, leaves the reader in place where a browser tab scrolls each time, so the changeset's "as a browser tab does" and "# goes back to the top" hold only once this is fixed. A smaller point: a page's own document click handler for # links, added after the viewer script, now runs after the hash is set and can no longer stop the jump. CI's test and build jobs were cancelled at this head because CI was full, so they need a re-run.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • Changeset: an in-page link keeps working in a viewer that shows the file in an inline-document (srcdoc) frame: verified for the first click (Chromium, sandboxed srcdoc frame: the frame stays loaded and moves to the section; JSDOM case)
  • Changeset: on the base the click navigated the frame away: verified (Chromium: the first click reloads the frame with the viewer's page; the new test fails on the base at its first assertion)
  • Changeset: the file moves to the place as a browser tab does, scrolling there, setting :target and firing hashchange: false for a repeat click on the same link (finding); scroll and hashchange verified for the first click in Chromium; :target follows from the fragment navigation and was not probed
  • Changeset: # goes back to the top: verified the first time; false on a second click (finding)
  • Changeset: a link the page handles itself, one with a target, and a modified click keep their own way: verified for element handlers (test) and in code (client-bundle.mjs:61-64); a page's own document-level handler added later runs after the viewer script (non-blocking)
  • Changeset: the author credit line: verified
  • Description: the handling applies only when the document's base address differs from its own, so a file opened from disk or from a real address is unchanged: verified (client-bundle.mjs:65; the file opened as a top-level page behaves identically on base and head in Chromium)
  • Description: the render command is experimental under the release record's experimental-isolation clause: verified
  • Description: the maintainers decided the file works in a viewer frame as in the app: no record states it; consistent with the link and form handling already on the base
  • Description: the smallest restoration is the viewer script and a changeset: verified, plus the regression test
  • Description: the JSDOM test covers a chip link, # and a self-handled link, and fails on the base: verified (fails on the base, passes on the head)
  • Description: five of five in-page link pages in a sandboxed srcdoc frame behave as in a top-level tab: not reproduced (the pages are not in the pull request); a repeat click on the same link does not (finding)
  • Description: two control pages still pass and a modified click opens a tab: not reproduced; the modifier branch is verified in code
  • Description: no new public API, default or interaction model, and no internal context: verified
  • Description: the render tests pass: verified (80 tests in nine files on the head)

Files:

  • packages/cli/foundation/render/client-bundle.mjs: finding (a repeat click on the same in-page link does nothing, line 68)
  • .changeset/render-in-page-links.md: finding (the browser-tab and back-to-top claims are false from the second click on)
  • packages/cli/api/render/render.interactive.test.mjs: clear (fails on the base, passes on the head); add the repeat click with the fix

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: in-page links now stay in the file in a srcdoc viewer frame and scroll again on a repeat click, but not for a link whose id the URL encodes.

  • A repeat click on a link such as #café does nothing in the frame, because packages/cli/foundation/render/client-bundle.mjs:88 compares the percent-encoded location.hash (#caf%C3%A9) with the written href and then assigns the same fragment again, so compare new URL(href, location.href).hash with location.hash instead, decode the id inside a try only for the lookup (line 87 also throws URIError for an href such as #100%), and add a non-ASCII id to the test's repeat click.

Both earlier points are fixed: a repeat click on an ASCII link or on # scrolls again in Chromium as in a tab, and a document click handler the page adds later now cancels the move. A smaller point: a click listener the page adds on window after the file's script still runs after the move, so it cannot cancel it. Some CI test shards were still running at this head.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Title: an in-page link stays in the file in a srcdoc viewer frame: verified (Chromium: the frame stays loaded; on the base it reloads with the viewer's page)
  • Changeset: an in-page link keeps working in a viewer that shows the file in an inline-document frame: verified for first clicks and for repeat clicks on ASCII ids; false for a repeat click on an encoded id (finding)
  • Changeset: on the base the click navigated the frame away: verified (Chromium; the new test fails on the base at its first assertion)
  • Changeset: the file moves to the place as a browser tab does, scrolling there, setting :target and firing hashchange: scroll and hashchange verified on the first click; :target follows from the fragment navigation and was not probed; false for a repeat click on an encoded id (finding)
  • Changeset: # goes back to the top: verified, also on a repeat click
  • Changeset: a link the page handles itself, one with a target, and a modified click keep their own way: verified (test; client-bundle.mjs:79-83)
  • Changeset: the author credit line: verified
  • Description: the handling takes only a primary, unmodified click on a # link with no target or download, and only when the document's base address differs from its own: verified (client-bundle.mjs:78-85)
  • Description: it sets location.hash, and when the hash already matches it scrolls to the place directly: verified for ASCII ids and #; false for encoded ids (finding)
  • Description: # and #top go to the top: # verified in Chromium; #top verified in code (client-bundle.mjs:93-95)
  • Description: a bubbling window listener lets a link the page handles itself, also from a handler added later, keep its way: verified for element and document handlers (test); a window listener the page adds later runs after the move (non-blocking)
  • Description: a file opened from disk or from a real address is unchanged: verified (the file as a top-level page reads the same on base and head in Chromium)
  • Description: the render command is experimental under the release record's experimental-isolation clause: verified
  • Description: the maintainers decided the file works in a viewer frame as in the app: no record states it; consistent with the viewer handling already on the base
  • Description: the smallest restoration is the viewer script and a changeset: verified, plus the regression test
  • Description: the JSDOM case covers the chip link, the repeat click, #, and page-handled links including a later document handler, and fails on the base: verified (fails on the base and on the previous revision, passes on the head)
  • Description: five in-page link pages and two control pages behave as in a tab in Chromium: not reproduced (the pages are not in the pull request); this review's probe agrees for ASCII ids and #, and differs for an encoded id (finding)
  • Description: no new public API, default or interaction model, and no internal context: verified
  • Description: the render tests pass: verified

Files:

  • packages/cli/foundation/render/client-bundle.mjs: finding (repeat click on an encoded id, lines 87-88)
  • .changeset/render-in-page-links.md: finding (the browser-tab claim is false for encoded ids until the fix)
  • packages/cli/api/render/render.interactive.test.mjs: clear (fails on the base and on the previous revision, passes on the head); add an encoded id with the fix

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: a repeat click on an in-page link such as #café or #100% now scrolls again in a srcdoc frame, and every step checked in Chromium matches a top-level tab (scroll position, hash and :target). CI is still running at this head, and test-build failed when its checkout step timed out, which is unrelated to this change and needs a rerun.

Two small, non-blocking points on the new listener in packages/cli/foundation/render/client-bundle.mjs:

  • The capture gate at line 108 matches the raw attribute, so <a href=" #big"> still loads the viewer's page into the frame while moveToPlace and the browser trim it; gating on the trimmed href of closest('a[href]') fixes it.
  • The queued listener at lines 109-112 runs on the next click that reaches the window, so when a link's handler clicks another in-page link, the outer move runs during the inner click, before a document listener can cancel it; checking e === event in last fixes it.
Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Title: an in-page link stays in the file in a srcdoc viewer frame: verified (Chromium: the frame stays loaded and matches a tab; on the base it reloads with the viewer's page)
  • Changeset: an in-page link keeps working in a viewer that shows the file in an inline-document frame: verified (Chromium, first and repeat clicks on #café, #100% and #)
  • Changeset: on the base the click navigated the frame away: verified (Chromium; the new test fails on the base at its first assertion)
  • Changeset: the file moves to the place as a tab does, scrolling there, setting :target and firing hashchange: verified (Chromium scroll position, hash and :target equal the tab's at every step; the test's page updates on hashchange)
  • Changeset: # goes back to the top: verified, also on a repeat click
  • Changeset: a link the page handles itself, one with a target, and a modified click keep their own way: verified (test; client-bundle.mjs:80-87)
  • Changeset: the author credit line: verified
  • Description: the handling takes only a primary, unmodified click on a # link with no target or download, and only when the base address differs from the document's own: verified (client-bundle.mjs:80-87); the gate at line 108 reads the untrimmed attribute (non-blocking)
  • Description: it cancels the navigation and sets location.hash, and on a matching hash it scrolls to the place directly: verified (Chromium)
  • Description: # and #top go to the top: # verified in Chromium; #top verified in code (client-bundle.mjs:101-103)
  • Description: the hash is compared as the browser stores it, so an encoded id works on a repeat click: verified (Chromium #café; test line 299)
  • Description: the decision runs after every listener the page adds on the document or the window, also one added later: verified for later document and window listeners (test); a nested click runs the outer move early (non-blocking)
  • Description: a file opened from disk or from a real address is unchanged: verified (the top-level page's frames are identical on base and head)
  • Description: the render command is experimental under the release record's experimental-isolation clause: verified
  • Description: the maintainers decided the file works in a viewer frame as in the app: no record states it; consistent with the viewer handling already on the base
  • Description: the smallest restoration is the viewer script and a changeset: verified, plus the regression test
  • Description: the JSDOM case covers the chip link, repeat clicks including encoded and undecodable ids, #, and page-handled links with later document and window handlers, and fails on the base: verified (fails on the base and on the previous revision, passes on the head)
  • Description: five in-page link pages and two control pages behave as in a tab in Chromium: not reproduced (the pages are not in the pull request); this review's probe agrees for the cases it covers
  • Description: no new public API, default or interaction model, and no internal context: verified
  • Description: the render tests pass: verified

Files:

  • packages/cli/foundation/render/client-bundle.mjs: two non-blocking notes (line 108, lines 109-112)
  • packages/cli/api/render/render.interactive.test.mjs: clear (fails on the base and on the previous revision, passes on the head)
  • .changeset/render-in-page-links.md: clear

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: after an in-page move in a srcdoc frame, focus now lands where a tab puts it for an element with that id, but a fragment that matches only a form field's name pulls focus into that field.

  • With <a href="#q"> and <input name="q"> and no element with id q, the sandboxed srcdoc frame focuses the off-screen input (packages/cli/foundation/render/client-bundle.mjs:97), while a top-level tab leaves focus on the link, because getElementsByName matches any named element and browsers match only <a name>; looking a name up only on anchors fixes it.

Non-blocking: a move to a place that takes no focus fires focusin and focusout on that place (lines 112-115), which a tab never does; on a repeat click, location.replace(location.href) makes the browser repeat the move itself (in Chromium it scrolled back and moved focus without reloading the frame), which would retire the lookup, the focus code and the focusable list. The two earlier notes on lines 118-122 still apply. CI at this head stopped before building because CI was full, so it needs a rerun.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none

Claims:

  • Title: an in-page link stays in the file in a srcdoc viewer frame: verified (Chromium: the frame keeps its one load through every step; the new test fails on the base at line 279)
  • Changeset: an in-page link keeps working in a viewer that shows the file in an inline-document frame: verified (Chromium)
  • Changeset: on the base the click navigated the frame away: verified (the test fails on the base at its first assertion)
  • Changeset: the file moves to the place as a tab does, scrolling there, setting :target and firing hashchange: verified (Chromium scroll position and :target equal the tab's; the test's page updates on hashchange)
  • Changeset: # goes back to the top: verified (test; client-bundle.mjs:99-103)
  • Changeset: a link the page handles itself, one with a target, and a modified click keep their own way: verified (client-bundle.mjs:80-88; test)
  • Changeset: the author credit line: verified
  • Description: in a srcdoc viewer every in-page link took the reader away: verified (base)
  • Description: the cause is the frame's base address being the viewer's page: verified
  • Description: only a primary, unmodified click on a written # link with no target or download, and only when the base address differs: verified (client-bundle.mjs:80-88); the capture gate reads the untrimmed attribute (carried note)
  • Description: the click is cancelled and location.hash set; a matching hash scrolls to the place directly: verified (Chromium, repeat click after scrolling up)
  • Description: # and #top go to the top, and an element with id top wins: verified (client-bundle.mjs:97-103; test)
  • Description: the hash is compared as the browser stores it, so an encoded id works on a repeat click: verified (test)
  • Description: the decision runs after every page listener on the document or the window, also one added later: verified (test); a nested click runs the outer move early (carried note)
  • Description: after the move, focus goes where a browser puts it: verified for a section that takes no focus and a tabindex="-1" heading (Chromium, including the next Tab); false for a fragment that matches only a form field's name (blocking finding)
  • Description: a link that names no element leaves focus on the link, as a browser does: verified for #top; false for a fragment that matches only a form field's name (same finding)
  • Description: a file opened from disk or from a real address is unchanged: verified (client-bundle.mjs:87; the top-level page logs only the browser's own focus events)
  • Description: the render command is experimental under the release record's experimental-isolation clause: verified
  • Description: the maintainers decided the file works in a viewer frame as in the app: no record states it; consistent with the viewer handling already on the base and the CLI architecture record's description of the script
  • Description: the smallest restoration is the viewer script and a changeset: verified, plus the regression test
  • Description: the JSDOM case covers the chip link, repeat clicks with encoded and undecodable ids, #, page-handled links with later document and window handlers, and focus after the move, and fails on the base: verified (fails on the base at line 279 and on the previous revision at line 285, passes on the head)
  • Description: a set of Chromium pages behaves as in a tab: not reproduced (the pages are not in the pull request); this review's probe agrees for id targets and disagrees for a name-only target
  • Description: in Chromium, a tab and the frame give the same focus after a move to a place that takes no focus and to a tabindex="-1" heading: verified for equivalent cases
  • Description: one defect, no new public API, default or interaction model, and no internal context: verified
  • Description: the render tests pass: verified (305 passed, 3 skipped)

Files:

  • packages/cli/foundation/render/client-bundle.mjs: one blocking finding (line 97), one non-blocking note (lines 112-115), two carried non-blocking notes (lines 118-122)
  • packages/cli/api/render/render.interactive.test.mjs: clear (fails on the base and on the previous revision, passes on the head); it has no case for a name-only fragment
  • .changeset/render-in-page-links.md: clear

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: in-page links now stay in the file in a srcdoc viewer frame and a repeat click moves there again, but the first click on an href="#" link reloads the file.

  • packages/cli/foundation/render/client-bundle.mjs:95: while the frame's address has no fragment, href="#" reaches location.replace(location.href), which in Chromium reloads the file in a sandboxed srcdoc frame, so typed text, page state and the page's own click handling on that link are lost; location.replace(location.href.split('#')[0] + '#' + hash.slice(1)) keeps it a fragment move and made every probed case end as in a browser tab.
  • The description's Evidence bullet says the JSDOM case checks focus after the move and a repeat scroll for #100%, but the test no longer asserts focus or scrolling and clicks #100% once (render.interactive.test.mjs:276-292), so please describe what the test checks.

The two earlier non-blocking notes (the untrimmed capture selector and the queued listener not tied to its own click) still apply.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: an in-page link keeps working in a srcdoc frame: verified in Chromium for #intro, a repeat #usage and #top.
  • Claim: before, the click navigated the frame away: verified in Chromium on the base (the viewer's page loads into the frame).
  • Claim: the move scrolls, sets :target and fires hashchange: verified in Chromium.
  • Claim: # goes back to the top: false for the first click while the address has no fragment (the file reloads).
  • Claim: a link the page handles, a link with a target and a modifier click keep their way: verified (client-bundle.mjs:76-85, test :316).
  • Claim: the decision runs after page listeners on the document or the window, also later ones: verified (test :298-311).
  • Claim: an encoded id is compared as the browser stores it: verified (client-bundle.mjs:93-94, test :285-288).
  • Claim: focus goes where a browser puts it: verified for a named place; false for the first # click (focus on the body, a tab keeps it on the link).
  • Claim: a file opened from disk or from a real address is unchanged: verified (client-bundle.mjs:86; Chromium top-level cases identical on base and head).
  • Claim: the JSDOM case checks focus and repeat scrolling, also for #100%: false (test :276-292).
  • Claim: the test fails on the base: verified by reading (the base never cancels an in-page click).
  • Claim: the stated test command passes: verified (305 passed, 3 skipped).
  • Claims about the Chromium page sets and the generated cases: not reproducible from the pull request; contradicted for the first # click.
  • File .changeset/render-in-page-links.md: its # sentence is false (first finding).
  • File packages/cli/api/render/render.interactive.test.mjs: clear apart from the description mismatch (second finding).
  • File packages/cli/foundation/render/client-bundle.mjs: first finding; two carried non-blocking notes.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: in-page links now stay in the file in a srcdoc viewer frame, a repeat click moves there again and the first href="#" no longer reloads the file, but three cases still take the reader out of the file or out of the viewer.

  • packages/cli/foundation/render/client-bundle.mjs:101-103: the queued listener removes itself on the first click that reaches the window, so when an in-page link's own handler calls other.click() (to open a <details> before moving to it, say) the link's click is never cancelled and the frame loads the viewer's page, which the previous revision handled; returning early for another event before removing the listener restores the move.
  • Miss: an in-page link whose handler stops propagation (React's e.stopPropagation() on a link inside a clickable card) never reaches the window listener at client-bundle.mjs:105, so the frame still loads the viewer's page and the title's and changeset's "a link to a place in the page keeps working" does not hold for it; decide the move also when the page stops this click's propagation, or state the limit in the changeset and description.
  • packages/cli/foundation/render/client-bundle.mjs:96: a first href="#" on a fragment-less address takes the location.replace branch, which adds no history entry where a tab adds one, so the browser's Back after "Back to top" takes the whole viewer to the page before it instead of back to the reading position; assigning location.href to the same address keeps repeat clicks as they are and matches the tab.

The inline comments carry a sketch for each, checked in Chromium.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim (title, changeset): a link to a place in the page stays in the file in a srcdoc frame: verified in Chromium for plain links, a repeat click and a first #; false for a link whose handler clicks another element or stops propagation.
  • Claim: before, the click navigated the frame away and the page vanished: verified in Chromium on the base.
  • Claim: the move scrolls, sets :target and fires hashchange: verified in Chromium for scroll and hashchange; :target follows from the browser's own fragment move.
  • Claim: # goes back to the top: verified (same document, typed text kept); Back afterwards differs from a tab (third finding).
  • Claim: a link the page handles itself, one with a target or a download, and a modifier click keep their way: verified (client-bundle.mjs:80-87, test).
  • Claim: the decision runs after every page listener on the document or the window, also one added later: verified for listeners that cancel (test); false for a nested click (first finding).
  • Claim: encoded and non-encoded ids stay fragment moves: verified (test).
  • Claim: a file opened from disk or from a real address is unchanged: verified by reading (client-bundle.mjs:86).
  • Claim: the JSDOM case checks the listed behavior and fails on the base: verified; the hash readout is asserted once, for #big.
  • Claim: the stated test command passes: verified (305 passed, 3 skipped).
  • Claim: a first # after typing keeps the typed text: verified in Chromium.
  • Claims about the Chromium page sets, history parity and the generated cases: not reproducible from the pull request; history after a first # differs from a tab.
  • File .changeset/render-in-page-links.md: its first sentence overstates for the second finding's links.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: three findings.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7262b6f

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: a link whose own handler clicks another element first now moves within the file as in a browser tab, but two cases still take the reader out of the file or out of the viewer.

  • Miss: an in-page link whose handler stops propagation (React's e.stopPropagation() on a link inside a clickable card) never reaches the queued window listener in packages/cli/foundation/render/client-bundle.mjs:98-111, so the srcdoc frame still loads the viewer's page and the title's and changeset's "a link to a place in the page keeps working" does not hold for it; decide the move also when the page stops this click's propagation, or state the limit in the changeset and description.
  • packages/cli/foundation/render/client-bundle.mjs:96: a first href="#" on an address with no fragment takes the location.replace branch, which adds no history entry where a tab adds one, so the browser's Back after "Back to top" takes the whole viewer to the page before it; assigning location.href to the same address keeps repeat clicks as they are and matches the tab.

The open inline threads on both lines carry a sketch for each.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim (title, changeset): a link to a place in the page stays in the file in a srcdoc frame: verified in Chromium for plain links, a repeat click, a link whose handler clicks another element first, and a first #; false for a link whose handler stops propagation.
  • Claim: before, the click navigated the frame away and the page vanished: verified in Chromium on the base.
  • Claim: the move scrolls, sets :target and fires hashchange: verified in Chromium.
  • Claim: # goes back to the top: verified (same document, typed text kept); Back afterwards differs from a tab.
  • Claim: a new place sets the hash and a repeat click replaces the address with the same fragment: verified (client-bundle.mjs:94-96); the replace branch also runs for a first # on an address with no fragment.
  • Claim: a link the page handles itself, one with a target or a download, and a modifier click keep their way: verified by reading client-bundle.mjs:80-87 and by the test.
  • Claim: the decision runs after every page listener on the document or the window, also one added later: verified for listeners that cancel and for a handler that clicks another element first; it never runs when the page stops the click's propagation.
  • Claim: encoded and non-encoded ids stay fragment moves: verified by the test.
  • Claim: a file opened from disk or from a real address is unchanged: verified by reading client-bundle.mjs:86 and in a top-level tab.
  • Claim: the command is experimental, so the change is an experimental patch: verified against the release-compatibility spec.
  • Claim: the JSDOM case checks the listed behavior and fails on the base: verified; its new nested-click assertion also fails against the previous revision.
  • Claim: the stated test command passes: verified (305 passed, 3 skipped).
  • Claim: no new public API, default or interaction model, and no internal context in public text: verified.
  • Claims about the frozen Chromium page sets, the focus steps and the generated-case suite: not reproducible from the pull request; history after a first # differs from a tab.
  • File .changeset/render-in-page-links.md: its first sentence overstates for links whose handler stops propagation.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: two findings.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 9006b4c

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: a link whose handler stops propagation now moves within the file, and Back after a first # stays in the viewer, but the new stopped-click path now moves a link the page has cancelled.

  • packages/cli/foundation/render/client-bundle.mjs:124-130: once a handler stops the click, the file cancels it and moves unless the page called preventDefault(), so a link whose onclick handler stops propagation and returns false (or sets returnValue = false) now scrolls to its place and fires hashchange in a srcdoc frame, where a tab and the base leave the page alone, and the changeset's "A link the page handles itself … keep their own way" and the description's "it moves unless the page cancelled the click" do not hold; since no microtask can see a return false, narrow both sentences to a cancel made with preventDefault().

The inline comment on line 128 has the reproduction.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim (changeset, title): a link to a place in the page keeps working in a viewer frame given its document inline: verified in Chromium for plain links, a repeat click, a link whose handler stops propagation, cancelBubble and a first #, and by the JSDOM case.
  • Claim (changeset): before, the click navigated the frame away and the page vanished: verified in Chromium on the base.
  • Claim (changeset): the file moves as a tab does, scrolling, setting :target and firing hashchange: verified in Chromium.
  • Claim (changeset): # goes back to the top: verified (same document, typed text kept, Back returns to the reading position).
  • Claim (changeset): a link with a target and a click with a modifier key keep their way: verified by reading client-bundle.mjs:81-84.
  • Claim (changeset): a link the page handles itself keeps its way: verified for a cancel with preventDefault() (test and Chromium); false for a link whose handler stops propagation and cancels by returning false or setting returnValue.
  • Claim: a new place adds a history entry and only a repeat click replaces the address: verified (client-bundle.mjs:92-96, the test's history assertion, Chromium).
  • Claim: the decision runs after every page listener on the document or the window, also one added later: verified by the test's window and document cancel listeners.
  • Claim: when the page stops the click's propagation, the file moves unless the page cancelled the click: verified for stopPropagation, stop-and-cancel and cancelBubble; false for a cancel by a handler's return value.
  • Claim: encoded and non-encoded ids stay fragment moves: verified by the test.
  • Claim: a file opened from disk or from a real address is unchanged: verified by reading client-bundle.mjs:85 and in a top-level tab.
  • Claim: the command is experimental, so the change is an experimental patch: verified against the release-compatibility spec.
  • Claim: the JSDOM case checks the listed behaviour and fails on the base: verified; it also fails against the previous revision (history assertion).
  • Claim: the stated test command passes: verified (305 passed, 3 skipped).
  • Claim: no new public API, default or interaction model, and no internal context in public text: verified.
  • Claims about the frozen Chromium page sets, the focus steps and the generated-case suite: their counts are not reproducible from the pull request; the stopped-propagation, cancel, first #, Back and repeat-click behaviour they name matches a tab, apart from the return-value cancel above.
  • File .changeset/render-in-page-links.md: its handled-link sentence overstates (finding above).
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: one finding.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 51c5fc3

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: the CI run on this head was cancelled because CI was full, so it needs a re-run before merge.

This push fixes the last blocking finding: a stopped in-page link whose page cancels the click with an onclick that returns false, or with returnValue = false, now stays put in a srcdoc frame, as in a browser tab, and the new assertion pins it.

  • Non-blocking: setting returnValue to a falsy value other than false (0, '', null) no longer cancels an in-page link in the frame (client-bundle.mjs:146); if (!value) this.preventDefault(); matches the browser.
Claims and files checked

Review mode: incremental; reason: none

  • Claim: a patch-level experimental release note for the CLI. Verified: the changeset's front matter and [experimental] prefix.
  • Claim: in-page links keep working in a viewer's srcdoc frame. Verified: client-bundle.mjs:104-180, the JSDOM case and a Chromium check.
  • Claim: before, the click loaded the viewer's page into the frame. Verified: on the base, Chromium loads the host page into the frame.
  • Claim: the move scrolls, sets :target and fires hashchange as a tab does. Verified: moveTo assigns the frame's own address (client-bundle.mjs:92-96); the hash readout in the test and in Chromium.
  • Claim: # goes back to the top without loading the file again. Verified: the test asserts about:srcdoc# and that the document stays.
  • Claim: a link the page handles itself, one with a target, and a modifier click keep their own way. Verified for preventDefault(), return false, returnValue = false, target, download and modifier keys (client-bundle.mjs:77-87, :111-158), with the falsy-value exception above.
  • Claim: it acts only when the document's base address differs from its own, so a top-level file is unchanged. Verified: client-bundle.mjs:85.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:92-96 and the test's history assertion.
  • Claim: the decision waits for every page listener on the document or the window, also one added later. Verified: client-bundle.mjs:179 and the test's cancelling listeners.
  • Claim: a stopped click is held and decided after its handlers, moving unless the page cancelled it. Verified: client-bundle.mjs:149-158, the test and Chromium.
  • Claim: the listed JSDOM assertions, and that the case fails on the base. Verified: render.interactive.test.mjs:221-363; it fails on the base at :286.
  • Claim: Chromium page-set counts and the generated-case comparison. Not reproduced, since those pages are not in the pull request; this review's own Chromium check agrees on the stop, cancel and base cases.
  • Claim: no new public API and no internal context. Verified: no export or command doc changes, and no internal references in the added lines, title, body or commits.
  • Claim: the stated test command passes. Verified: 305 passed, 3 skipped.
  • File .changeset/render-in-page-links.md: clear.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: one non-blocking note at line 146.

Automated review (maintainer link)

@josephfarina josephfarina changed the title [experimental] render: a link to a place in the page stays in the file in a srcdoc viewer frame [experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame Nov 18, 2026
…e's, and move a link in a card that stops the click
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 123c7f7

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: the release note promises the in-page link fix for more viewers than the file recognises.

  • The changeset says the move also holds in a viewer that cancels in-page links "from its own listener on the frame's window or document", but the file recognises a viewer's cancel only on the capture phase before its own listeners (packages/cli/foundation/render/client-bundle.mjs:146, :174-175), so a viewer that cancels from a bubble-phase listener, or from a window capture listener that also stops the click, still leaves a hash-routed page on its first view, as before; narrow the sentence in .changeset/render-in-page-links.md to those capture-phase viewer listeners, or recognise the other viewers too.

The findings from the last review are fixed: a page's own capture-phase handling keeps its way, a stopped link moves in a cancelling viewer, and a falsy returnValue cancels. Non-blocking: the IN_A_VIEWER JSDoc (client-bundle.mjs:39-43) describes the move that now lives in VIEWER_MOVES, and the namespace comment at line 362 still names only storage and the clipboard.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: in a viewer that gives the frame its document inline, an in-page link took the reader away. Verified: on the base, Chromium loads the viewer's page into the frame.
  • Claim: some viewers cancel such a link and only scroll, so a page that routes on its address never switches. Verified: on the base, a viewer that cancels on the document or the window leaves the page on its first view.
  • Claim: the cause is that the frame's base address is the viewer's page. Verified: the move runs only when the base address differs from the document's own (client-bundle.mjs:110).
  • Claim: only an unmodified primary click on a #… link with no target or download is taken. Verified: client-bundle.mjs:102-112.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:117-121 and the test's address and history assertions.
  • Claim: scroll, :target, hashchange and focus behave as in a tab, encoded and missing ids included. Verified for hashchange, encoded and non-encoded ids, and view and address parity with a tab in Chromium; :target and focus come from the browser's own fragment navigation and were not probed separately.
  • Claim: the decision runs after every listener the page adds on the document or the window, so a link the page handles itself keeps its way. Verified: the test's later window and document listeners, and in Chromium the page's own document capture handler.
  • Claim: a stopped click is held and decided after its handlers, and moves unless the page cancelled it. Verified: the test's stop, return false and returnValue cases, and the card link in Chromium.
  • Claim: a capture-phase cancel on the window or document from the frame's host holds the browser's move and the file still moves. Verified for viewer scripts that run before the file's, on both targets, in Chromium.
  • Claim: a file opened from disk or at a real address is unchanged. Verified: client-bundle.mjs:110 and the top-level tab run.
  • Claim: the command is experimental and the file should work in a viewer's frame as in the app. Verified: the release spec's experimental clauses and the export command's doc.
  • Claim: the smallest restoration is the viewer script and a changeset. Verified: those plus two test files are the only changes.
  • Claim: the listed JSDOM assertions, and that the test fails on the base. Verified: the assertions are present and pass on the head; on the base no listener cancels an in-page link, so the first assertion fails.
  • Claim: the frozen Chromium page sets, the step-by-step parity runs and the generated-case comparison. Not reproduced, since those pages are not in the pull request; this review's own Chromium probe agrees for plain frames and capture-phase viewers.
  • Claim: one defect, no new public API, no internal context. Verified: no export, command or option changes, and no internal references in the added lines, title, body, branch or commits.
  • Claim: the stated test commands pass. Verified: the render suites pass (347 passed, 3 skipped) and the browser parity file passes in Chromium (3 of 3).
  • Release note claim: an [experimental] patch for the CLI naming astryx experimental export. Verified.
  • Release note claim: an in-page link keeps working in a srcdoc viewer frame, where it used to navigate the frame away. Verified: test and Chromium.
  • Release note claim: the file scrolls, sets :target, fires hashchange, and # goes back to the top. Verified for hashchange and #; :target follows the browser's own fragment navigation.
  • Release note claim: this also holds in a viewer that cancels such a link from its own listener on the frame's window or document, a link in a stopping card included. False for a bubble-phase viewer listener and for a window capture listener that also stops the click (blocking finding); verified for capture-phase listeners, the card link included.
  • Release note claim: a link the page cancels or handles itself, one with a target, and a modifier click keep their own way. Verified: client-bundle.mjs:106-109, the test, and Chromium.
  • File .changeset/render-in-page-links.md: one sentence claims more viewers than the file recognises (blocking finding).
  • File .github/scripts/render-interaction-parity.browser.test.mjs: clear; the new case covers capture-phase viewers only, and the step type's JSDoc is back above STEPS.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: the viewer recognition at lines 146 and 174-175 is behind the blocking finding; non-blocking stale comments at lines 39-43 and 362.

Automated review (maintainer link)

Comment thread .changeset/render-in-page-links.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 9c1965f

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not finished on this head yet, so its required checks still need to pass before merge.

The release note now promises the in-page link move only for viewers that cancel the link on its way down from a listener added before the file's script, which is what the file recognises, and the two stale comments now point at VIEWER_MOVES. Nothing else is needed from you.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: in a viewer that gives the frame its document inline, an in-page link took the reader away. Verified: on the base, Chromium loads the viewer's page into the frame.
  • Claim: some viewers cancel such a link on its way down and only scroll, so a page that routes on its address never switches. Verified: on the base, a viewer that cancels on the document's capture phase leaves the page on its first view.
  • Claim: the cause is that the frame's base address is the viewer's page. Verified: the move runs only when the base address differs from the document's own (client-bundle.mjs:109).
  • Claim: only an unmodified primary click on a #… link with no target or download is taken. Verified: client-bundle.mjs:101-110.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:116-120 and the test's address and history assertions.
  • Claim: scroll, :target, hashchange and focus behave as in a tab, encoded and missing ids included. Verified for hashchange and for encoded and non-encoded ids; scroll, :target and focus come from the browser's own fragment navigation and were not probed separately.
  • Claim: the decision runs after every listener the page adds on the document or the window, later ones included. Verified: the test's later window and document listeners.
  • Claim: a stopped click is held and decided after its handlers, and moves unless the page cancelled it. Verified: the test's stop, return false and returnValue cases, and the card link in Chromium.
  • Claim: the move runs in the script's first module, before the page's own modules. Verified: client-bundle.mjs:515 and :583, and the code order in a real export.
  • Claim: a cancel counts as the viewer's only when a listener the viewer added on the window or document before the file's script makes it on the way down, and the file then still moves. Verified: client-bundle.mjs:145 and :173-178, the parity case's document and window viewers, and Chromium frames of each tree's export.
  • Claim: a cancel from any of the page's own listeners keeps the page where it is. Verified: the parity case's cancelled link and the page's own document handler, and the JSDOM case.
  • Claim: a bubble-phase viewer listener is read as the page's and keeps the page's way. Verified: with such a viewer the head shows the same frame as the base.
  • Claim: the viewer's hold and a page's stop are tracked apart, so a card link still moves in such a viewer. Verified: client-bundle.mjs:145-146 and :169, and the parity case.
  • Claim: a file opened from disk or at a real address is unchanged. Verified: client-bundle.mjs:109.
  • Claim: the command is experimental, and the file should work in a viewer's frame as in the app. Verified: the release spec's experimental clauses and the export command's doc.
  • Claim: the smallest restoration is the viewer script and a changeset. Verified: those plus two test files are the only changes.
  • Claim: the listed JSDOM assertions, and that the test fails on the base. Verified: they pass on the head; on the base the case fails at its first in-page click (render.interactive.test.mjs:286).
  • Claim: the frozen Chromium page sets, the step-by-step parity runs and the generated-case comparison. Not reproduced, since those pages are not in the pull request; this review's own Chromium runs agree for plain frames and on-the-way-down viewers.
  • Claim: one defect, no new public API, no internal context. Verified: no export, command or option changes, and no internal references in the added lines, title, body, branch or commits.
  • Claim: the stated test commands pass. Verified: the render suites pass (347 passed, 3 skipped) and the browser parity file passes in Chromium (3 of 3).
  • Release note claim: an [experimental] patch for the CLI naming astryx experimental export. Verified.
  • Release note claim: an in-page link keeps working in a srcdoc viewer frame, where it used to navigate the frame away. Verified: test and Chromium.
  • Release note claim: the file scrolls, sets :target, fires hashchange, and # goes back to the top. Verified for hashchange and #; scroll and :target follow the browser's own fragment navigation.
  • Release note claim: this also holds in a viewer that cancels the link on its way down from a listener its own script adds on the frame's window or document before the file's script, a link in a card that stops the click included. Verified: the parity case and Chromium frames.
  • Release note claim: a link the page cancels or handles itself, one with a target, and a modifier click keep their own way. Verified: client-bundle.mjs:104-108, the test, and Chromium.
  • File .changeset/render-in-page-links.md: clear.
  • File .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 908d70e

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: a page's hash-routed views now also switch under a viewer that adds its document listener at DOMContentLoaded, but the later marker also reads a page's own early document handler as the viewer's, and the new release-note wording covers more viewers than the file recognises.

  • In packages/cli/foundation/render/client-bundle.mjs:140-142 the document marker now goes on only at DOMContentLoaded, so a document capture listener the page's own module adds while it loads counts as the viewer's: a page that cancels #help there to open its own panel now gets #help in the frame's address, a hashchange and a new history entry in a srcdoc frame, with or without a viewer script, where the base, the previous revision and a browser tab keep it on its first view; keep a marker at once too, add one after the mount has run the page's modules, and count a document cancel as the viewer's only before the first or between that one and the DOMContentLoaded one.
  • The release note's "on the frame's document by the time the document has loaded" (.changeset/render-in-page-links.md:5) also promises a viewer that adds its listener at the load event, which the file reads as the page's (its views stay on Home, as on the base), so say "from a DOMContentLoaded listener its script adds before the file's script runs" instead.

A page module with such a listener in the parity page would keep the first case covered.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: in a viewer that gives the frame its document inline, an in-page link took the reader away. Verified: on the base, Chromium loads the viewer's page into the frame after one click on a # link.
  • Claim: some viewers cancel such a link on its way down, from a window listener added before the file's script or a document listener added by the time the document has loaded, and only scroll, so a page that routes on its address never switches. Verified on the base for a window capture viewer and a DOMContentLoaded document viewer (the view stays on Home); a viewer that adds its listener at the load event is not recognised on the head either (see the second finding).
  • Claim: the cause is that the frame's base address is the viewer's page. Verified: the move runs only when the base address differs from the document's own (client-bundle.mjs:109).
  • Claim: only an unmodified primary click on a #… link with no target or download is taken. Verified: client-bundle.mjs:101-110.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:116-120 and the JSDOM case's address and history assertions.
  • Claim: scroll, :target, hashchange and focus behave as in a tab, encoded and missing ids included. Verified for hashchange and encoded and non-encoded ids; scroll, :target and focus come from the browser's own fragment navigation and were not probed separately.
  • Claim: the decision runs after every listener the page adds on the document or the window, later ones included. Verified: the JSDOM case's later window and document listeners.
  • Claim: a stopped click is held and decided after its handlers, and moves unless the page cancelled it. Verified: the JSDOM stop, return false and returnValue cases, and the card link in the parity case.
  • Claim: the move runs in the script's first module, before the page's own modules. Verified: client-bundle.mjs:518 and :586.
  • Claim: a cancel counts as the viewer's only when a viewer listener makes it on the way down, on the window before the file's listener or on the document before the file's marker. Verified in code (client-bundle.mjs:148, :176-177).
  • Claim: the marker goes on once the document has loaded, after the viewer's listener and before the listeners the page adds once it is mounted. Verified for DOMContentLoaded and for Effect-added page listeners (the parity case); listeners the page's modules add before it is mounted also come before the marker (first finding).
  • Claim: the viewer then holds the browser's move and the file still moves. Verified: the parity case's document, window and DOMContentLoaded viewers.
  • Claim: a cancel by any of the page's own listeners keeps the page where it is. False: a document capture listener the page's module adds while it loads is read as the viewer's, and the frame moves (first finding).
  • Claim: a bubble-phase viewer listener is read as the page's. Verified: byHost requires the capture phase (client-bundle.mjs:177).
  • Claim: the viewer's hold and a page's stop are tracked apart, so a card link still moves in such a viewer. Verified: client-bundle.mjs:148-149, :196-199, and the parity case.
  • Claim: a file opened from disk or at a real address is unchanged. Verified: client-bundle.mjs:109, and the same file top-level in Chromium keeps the page's own handling.
  • Claim: the command is experimental, and the file should work in a viewer's frame as in the app. Verified: the release spec's experimental clauses and the export command's doc.
  • Claim: the smallest restoration is the viewer script and a changeset. Verified: those plus two test files are the only changes.
  • Claim: the listed JSDOM assertions, and that the test fails on the base. Verified: they pass on the head; on the base the case fails at its first in-page click.
  • Claim: the frozen Chromium page sets, the step-by-step parity runs and the generated-case comparison. Not reproduced, since those pages are not in the pull request.
  • Claim: one defect, no new public API, no internal context. Verified: no export, command or option changes, and no internal references in the added lines, title, body, branch or commits.
  • Claim: the stated test commands pass, and the new DOMContentLoaded browser case fails on the previous revision and passes here. Verified: the render suites pass (347 passed, 3 skipped), the parity file passes in Chromium (3 of 3), and with the previous revision's script its new case stays on Home.
  • Release note claim: an [experimental] patch for the CLI naming astryx experimental export. Verified.
  • Release note claim: an in-page link keeps working in a srcdoc viewer frame, where it used to navigate the frame away. Verified: test and Chromium.
  • Release note claim: the file scrolls, sets :target, fires hashchange, and # goes back to the top. Verified for hashchange and #; scroll and :target follow the browser's own fragment navigation.
  • Release note claim: this also holds in a viewer that cancels on the way down from a window listener added before the file's script, or a document listener added by the time the document has loaded, a card link included. Verified for the window and DOMContentLoaded cases; false for a viewer that adds its listener at the load event (second finding).
  • Release note claim: a link the page cancels or handles itself from any of its own listeners, one with a target, and a modifier click keep their own way. False for a document capture listener the page's module adds while it loads (first finding); verified for the rest.
  • File .changeset/render-in-page-links.md: second finding, and the first finding contradicts its last sentence.
  • File .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: first finding.

Automated review (maintainer link)

Comment thread .changeset/render-in-page-links.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 0502244

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: a link the page's module cancels as it evaluates now keeps the page's way in a viewer frame, but the listener wrapper that does it changes how the page's own click handlers register and unregister, and a handler from a module the page loads with import() is still overridden.

  • In packages/cli/foundation/render/client-bundle.mjs:154-171 every exported file, also one opened at its own address, registers a click listener added at load as a wrapper but the same function added later as itself, and swaps in the wrapper for every removal, so a handler the page adds at load and again once mounted runs twice per click and one added for click and keydown is never removed for keydown (in Chromium one click counts 2 and an unlock handler reaches 3 after two keys, where the base shows 1 and 1); map only click, and once a function has a wrapper use it for every later click add and remove.
  • The page's loading window ends at the first microtask (client-bundle.mjs:147-150), so a document capture handler that a module loaded with import() (or a promise callback) adds at load is still read as the viewer's: in a sandboxed srcdoc frame its link opens the page's panel and also moves to #lazy with a new history entry, where the base and a tab stay put, contrary to the release note's "from any of its own listeners (also one its modules add while they load)" (.changeset/render-in-page-links.md:5); end that window at a capture DOMContentLoaded listener on window instead, or narrow the sentence.

CI has not run on this head because its commit message carries [skip ci]; push the fix without it so the required checks run.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: in a viewer that gives the frame its document inline, an in-page link took the reader away. Verified: the JSDOM case fails on the base at its first in-page click.
  • Claim: some viewers cancel such a link on its way down, from a window listener added before the file's script or a document listener added from a DOMContentLoaded listener added before it, and only scroll, so a page that routes on its address never switches. Verified: the parity case's three viewers switch views on the head.
  • Claim: the cause is that the frame's base address is the viewer's page. Verified: the move runs only when the base address differs from the document's own (client-bundle.mjs:109).
  • Claim: only an unmodified primary click on a #… link with no target or download is taken. Verified: client-bundle.mjs:101-111.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:116-120 and the JSDOM case's address and history assertions.
  • Claim: scroll, :target, hashchange and focus behave as in a tab, encoded and missing ids included. Verified for hashchange and encoded and non-encoded ids; scroll, :target and focus come from the browser's own fragment navigation.
  • Claim: the decision runs after every listener the page adds on the document or the window, later ones included. Verified: the JSDOM case's later window and document listeners.
  • Claim: a stopped click is held and decided after its handlers, and moves unless the page cancelled it. Verified: the JSDOM stop, return false and returnValue cases, and the card link in the parity case.
  • Claim: the move runs in the script's first module, before the page's own modules. Verified: client-bundle.mjs:549 and :617.
  • Claim: a cancel counts as the viewer's only when a viewer listener makes it on the way down, on the window before the file's listener or on the document before the file's marker. Verified in code (client-bundle.mjs:179, :207-210), apart from the second finding.
  • Claim: the marker goes on once the document has loaded, after the viewer's listener and before the listeners the page adds once it is mounted. Verified: the parity case's DOMContentLoaded viewer and its Effect-added page handler.
  • Claim: a click listener the page's modules add on the document or the window while they load is marked as the page's. Verified for listeners a module adds as it evaluates (the parity #faq case, which fails with the previous script); false for one a module loaded with import() or a promise callback adds (second finding).
  • Claim: the viewer then holds the browser's move and the file still moves. Verified: the parity case's document, window and DOMContentLoaded viewers.
  • Claim: a cancel by any of the page's own listeners keeps the page where it is. False for a listener added after the first microtask of load (second finding).
  • Claim: a bubble-phase viewer listener is read as the page's. Verified: byHost requires the capture phase (client-bundle.mjs:208).
  • Claim: the viewer's hold and a page's stop are tracked apart, so a card link still moves in such a viewer. Verified: client-bundle.mjs:179, :223-231, and the parity case.
  • Claim: a file opened from disk or at a real address is unchanged. False: the listener wrapper is installed in every file and changes how the page's click handlers register and unregister there too (first finding).
  • Claim: the command is experimental, and the file should work in a viewer's frame as in the app. Verified: the release spec's experimental clauses and the export command's doc.
  • Claim: the smallest restoration is the viewer script and a changeset. Verified: those plus two test files are the only changes.
  • Claim: the listed JSDOM assertions, and that the test fails on the base. Verified: they pass on the head; on the base the case fails at its first in-page click.
  • Claim: the frozen Chromium page sets, the step-by-step parity runs and the generated-case comparison. Not reproduced, since those pages are not in the pull request.
  • Claim: one defect, no new public API, no internal context. Verified: no export, command or option changes, and no internal references in the added lines, title, body, branch or commits.
  • Claim: the stated test commands pass, and the new browser cases fail on the previous revisions and pass here. Verified: the render suites pass (347 passed, 3 skipped), the parity file passes in Chromium (3 of 3), and with the previous revision's script the #faq case moves to #faq.
  • Release note claim: an [experimental] patch for the CLI naming astryx experimental export. Verified.
  • Release note claim: an in-page link keeps working in a srcdoc viewer frame, where it used to navigate the frame away. Verified: test and Chromium.
  • Release note claim: the file scrolls, sets :target, fires hashchange, and # goes back to the top. Verified for hashchange and #; scroll and :target follow the browser's own fragment navigation.
  • Release note claim: this also holds in a viewer that cancels on the way down from a window listener added before the file's script, or a document listener added from a DOMContentLoaded listener added before it, a card link included. Verified: the parity case.
  • Release note claim: a link the page cancels or handles itself from any of its own listeners, module-load ones included, one with a target, and a modifier click keep their own way. False for a listener from a module loaded with import() (second finding); verified for the rest.
  • File .changeset/render-in-page-links.md: second finding.
  • File .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: first and second findings.

Automated review (maintainer link)

…end the page's load window at DOMContentLoaded

[skip ci]
… listener, and tidy the move's comments

[skip ci]
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec ed6c6ff

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: in-page links in the exported file stay in the file in a srcdoc viewer frame, and the listener wrapper now registers and removes the page's own click handlers as a browser tab does, including one from a module loaded with import().

The commits on this head carry [skip ci], so the required checks have not run here; they need to run and pass before this can merge.

  • Non-blocking, Miss: the wrapper calls the addEventListener it captured at startup (packages/cli/foundation/render/client-bundle.mjs:136, :157, :160), so a library that patches EventTarget.prototype after load no longer sees registrations on document and window, also at the file's own address; looking the method up when the wrapper runs keeps such patches working.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: in a viewer that gives the frame its document inline, an in-page link took the reader away. Verified: on the base the JSDOM case fails at its first in-page click, and in Chromium the frame loads the viewer's page.
  • Claim: some viewers cancel such a link on its way down, from a window listener added before the file's script or a document listener added from their document DOMContentLoaded listener, and only scroll, so a page that routes on its address never switches. Verified: on the base the routes page stays on Home under such a viewer; on the head it switches.
  • Claim: the cause is that the frame's base address is the viewer's page. Verified: the move runs only when the base address differs from the document's own (client-bundle.mjs:103).
  • Claim: only an unmodified primary click on a #… link with no target or download is taken. Verified: client-bundle.mjs:95-104.
  • Claim: a new place adds a history entry and a repeat click replaces the address. Verified: client-bundle.mjs:110-114 and the JSDOM history assertions.
  • Claim: scroll, :target, hashchange and focus behave as in a tab, encoded and missing ids included. Verified for hashchange, scroll and encoded and non-encoded ids; :target and focus come from the browser's own fragment navigation.
  • Claim: the decision runs after every listener the page adds on the document or the window, later ones included. Verified: the JSDOM case's later window and document listeners.
  • Claim: a stopped click is held and decided after its handlers, and moves unless the page cancelled it. Verified: the JSDOM stop, return false and returnValue cases, and the card link in the parity case.
  • Claim: the move runs in the script's first module, before the page's own modules. Verified: client-bundle.mjs:552 and :620.
  • Claim: a cancel counts as the viewer's only when a viewer listener makes it on the way down, on the window before the file's listener or on the document before the file's marker, which goes on once the document has loaded. Verified: client-bundle.mjs:136-140 and :177-216, and the parity case's three viewers.
  • Claim: a click listener the page adds while the document loads, from its modules, an import() or a promise callback, is marked as the page's, until a capture DOMContentLoaded listener on the window; a viewer listening for DOMContentLoaded on the window is not covered. Verified: client-bundle.mjs:146-149, the parity FAQ and Lazy cases, and a Chromium probe of a promise-callback listener.
  • Claim: only click is wrapped, one wrapper per handler, so a handler added at load and again once mounted registers once and removing a handler for another event type removes it. Verified: client-bundle.mjs:157-174, the parity registration case, and a Chromium probe that counts as the base does.
  • Claim: the viewer holds the browser's move and the file still moves, so a page that routes on its address sees the new place. Verified: the parity case's document, window and DOMContentLoaded viewers.
  • Claim: a cancel by any of the page's own listeners keeps the page where it is. Verified for listeners on elements and for document and window listeners added while the document loads or after it.
  • Claim: a bubble-phase viewer listener is read as the page's. Verified: the viewer test requires the capture phase (client-bundle.mjs:211).
  • Claim: the viewer's hold and a page's stop are tracked apart, so a card link still moves in such a viewer. Verified: the parity case.
  • Claim: a file opened from disk or at a real address is unchanged. Verified for the in-page link path and the page's own listeners; a library that patches EventTarget.prototype after load misses document and window registrations (non-blocking note).
  • Claim: the command is experimental, and the file should work in a viewer's frame as in the app. Verified: the release spec's experimental clauses and the export module's documented role.
  • Claim: the smallest restoration is the viewer script and a changeset. Verified: those plus two test files are the only changes.
  • Claim: the listed JSDOM assertions, and that the test fails on the base. Verified: they pass on the head and fail on the base.
  • Claim: the frozen Chromium page sets, the step-by-step parity runs and the generated-case comparison. Not reproduced, since those pages are not in the pull request.
  • Claim: one defect, no new public API, no internal context. Verified: no export, command or option changes, and no internal references in the added lines, title, body, branch or commits.
  • Claim: the stated render test command passes. Verified: 347 passed, 3 skipped.
  • Claim: the browser parity file covers a hash-routed page with and without viewer scripts, a page-cancelled link, the FAQ and Lazy links and handler registration, and the two newest cases fail on the previous revision and pass here. Verified: 4 of 4 pass on the head; with the previous revision's script the Lazy link moves and the unlock handler runs twice. The older-revision failures named for the DOMContentLoaded viewer and FAQ cases were not rerun.
  • Claim: the preflight's lint, build, typecheck and test results. Not reproduced: CI has not run on this head; the render suites pass here.
  • Claim: the release note and description now name only a viewer's document listener. Verified: the release note text.
  • Release note claim: an [experimental] patch for the CLI naming astryx experimental export. Verified.
  • Release note claim: an in-page link keeps working in a srcdoc viewer frame, where it used to navigate the frame away. Verified: test and Chromium.
  • Release note claim: the file scrolls, sets :target, fires hashchange, and # goes back to the top. Verified for scroll, hashchange and #; :target follows the browser's own fragment navigation.
  • Release note claim: this also holds in a viewer that cancels on the way down from a window listener added before the file's script, or a document listener added from its document DOMContentLoaded listener, a card link included. Verified: the parity case.
  • Release note claim: a link the page cancels or handles itself from any of its own listeners, module-load ones included, one with a target, and a modifier click keep their own way. Verified: JSDOM, parity and probe cases.
  • File .changeset/render-in-page-links.md: clear.
  • File .github/scripts/render-interaction-parity.browser.test.mjs: clear.
  • File packages/cli/api/render/render.interactive.test.mjs: clear.
  • File packages/cli/foundation/render/client-bundle.mjs: non-blocking note.

Automated review (maintainer link)

for (const target of [document, window]) {
const remove = target.removeEventListener;
target.addEventListener = function (type, listener, options) {
if (type !== 'click' || !listener) return add.call(this, type, listener, options);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking, Miss: add is the prototype's addEventListener as it was when this script started (line 136; remove at line 155), so this line and line 160 bypass any patch the page makes to EventTarget.prototype later. A library that wraps listeners that way (an error reporter, a passive-listener polyfill) then misses every registration on document and window, also when the file is opened at its own address. In Chromium, a page whose Effect patches the prototype and then adds keydown and click on document and resize on window records all three on the base and none here. Looking the method up when the wrapper runs keeps such patches:

if (type !== 'click' || !listener) return EventTarget.prototype.addEventListener.call(this, type, listener, options);

with the same lookup at line 160 and in removeEventListener.

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12635 fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names
  Author: @josephfarina
- #12727 fix(cli): export loads a served package's subpath exported only to imports
  Author: @josephfarina
- #12224 fix(cli): a {@link} in a template description resolves as astryx docs resolves it
  Author: @josephfarina
- #12278 fix(core): a Theme given a value that is not a theme keeps the page running
  Author: @josephfarina
- #12751 feat(Layout): LayoutContent names its container, so a theme styles a dialog's body apart from its header and footer
  Author: @josephfarina
- #12168 fix(templates): header, footer and toolbar rows wrap for longer translated labels
  Author: @josephfarina
- #12399 [experimental] export: the dropped-text warning checks Core's docs, and text not drawn yet inside Core components that take children no longer warns
  Author: @josephfarina
- #12541 [docs] Core: list the props ComplexSelector, Selector, Toast and ContextMenuItem take
  Author: @josephfarina
- #12676 docs(cli): a short form keeps its own 640 column inside a wide template frame
  Author: @josephfarina
- #12458 fix(core): Field labels use the primary text colour
  Author: @josephfarina
- #12373 [experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12827.

@github-actions
github-actions Bot deleted the josephfarina/rl-fragment-links branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — ed6c6ff7 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant