Skip to content

fix: keep the external-link description span out of the page's body - #5444

Merged
leaf-agent merged 1 commit into
mainfrom
fix/external-link-description-in-chrome
Nov 5, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/external-link-description-in-chrome

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Every external link's aria-describedby points at one hidden "opens in a new tab" span, and declared-words.js appended that span to document.body. Since #5228, body's children are the page's own elements (pageDocument() returns body), so the span sat beside main and changed what the page's structural selectors match, such as main:last-child or main + *. The render gate's apparatusAmongAuthored probe caught this on every corpus page with an external link. In scheduled run 41816958231 it reported <span>, which Leaf adds, stands among the page's own elements inside <body> for github-discoveries, pr-walkthrough, rust-sort and others. The span now lives in the chrome root (chromeRoot, mounted after body in both the live and the export boot paths). It is in the same document, so the link's accessible description doesn't change. Inside a shadow root the span still lives in that root.

Verification on Linux:

  • test_page_fixture_renders[github-discoveries], [pr-walkthrough], [rust-sort] and [alert-review] from tests/journeys/test_render_gate.py (run with --run-nightly) pass. Without this change, github-discoveries fails with the finding above; the debug output showed the offending element as <span data-lf-gen="1" id="lf-external-description-1" hidden data-lf-runtime>.
  • That gate run also carried Read the page's controls from the root element in two test readers #5439's one-line reader_state change. Without it these cases also fail with g opened no go-to, which Read the page's controls from the root element in two test readers #5439 owns.
  • The accessible-description tests test_a_render_of_an_external_links_words_keeps_its_treatment and test_an_external_link_says_and_opens_where_it_goes pass.
  • pnpm run test:runtime (810) and pnpm run check pass.

One pr-walkthrough run also ended with a teardown error, ResizeObserver loop completed with undelivered notifications on versions/v1.html. The same error appears in run 41816958231 before this change, on pr-walkthrough, notification-playground and thread-panel-gallery, so it is a separate cause.

Refs #4225 — automated triage

The hidden "opens in a new tab" description that every external link's
aria-describedby names was appended to document.body. Since #5228 body's
children are the page's own elements, so the span stood beside main and
changed what the page's structural rules (main:last-child, main + *) match.
The render gate's apparatus-among-authored probe failed on every corpus
page with an external link (github-discoveries, pr-walkthrough, rust-sort
and others in scheduled run 41816958231). The span now waits in the
chrome root, in the same document, so the link's accessible description
is unchanged. A shadow root still holds its own copy.

Refs #4225
@leaf-agent
leaf-agent merged commit 64bb84f into main Nov 5, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/external-link-description-in-chrome branch November 5, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant