Skip to content

Keep the comment note out of the page's structure - #1356

Merged
max-sixty merged 9 commits into
mainfrom
comment-note-out-of-flow
Sep 27, 2026
Merged

max-sixty merged 9 commits into
mainfrom
comment-note-out-of-flow

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The hidden "N comments" note was a button appended inside each commented block, so while a comment stood it was the block's last child and the page's own :last-child, :only-child and :nth-last-child rules stopped matching. With .list > :last-child { margin-bottom: 80px }, one comment on the list moved the next paragraph up 67px. That broke the norm in skills/leaf/assets/AGENTS.md, "Space and scrolling": nothing Leaf draws moves the page's content.

The note now stands in a shelf inside the chrome (.lf-chrome), and the block names it through aria-details, ARIA's relation for an annotation. The block's only trace is that attribute. It is written through element reflection (ariaDetailsElements), which reaches the note from a block inside a widget's shadow tree, where an id reference cannot. aria-owns would have kept the note in the block's reading order, but Chrome has no ariaOwnsElements, so it could not serve blocks inside shadow trees. The block's own aria-details, authored or written by a later revision, is kept ahead of the note and restored when the note goes.

What moved for users:

  • A screen reader gets a details relation on the block, pointing at a button named for the block ("2 comments on § paragraph · The first passage…"), instead of reading "2 comments, button" at the end of the block's text. How screen readers announce aria-details, and whether they offer a way to move to it, varies. The tests check the relation in Chrome's accessibility tree, not with a screen reader.
  • The note is no longer a Tab stop, since from the chrome it would come after the whole page. The keyboard reaches a block's threads through c, t and the margin row. Focusing the note, as a screen reader moving to it does, stands at its block (a declared side in standing-target.js), so the thread card and the Threads list follow it as they did when it sat inside the block.
  • At rest the note is transparent, takes no pointer, and is fixed under the banner. Focused, it shows the skip link's chip, with the skip link's inset ring.
  • threadEntryAt in margin-projection.js now reads the standing place rather than DOM containment. That also reaches a margin cluster control: with Threads open, c on a target's marker now continues the thread the list expanded for it, as the glossary's Standing target says every side answers alike. Before, the list expanded that thread and c started a new comment.

reach.js no longer excludes the note when it asks whether a scroller holds a control of its own, and the render checks no longer name it. The gate tests that used the note as the out-of-flow word inside a scroller now plant a .lf-quiet word, the case that containment still serves. New tests cover the list geometry (fails on main: the paragraph moves from 310px to 243px), the relation across a revision, and c from the margin marker (fails on main).

TODO.md drops the item this closes and adds the two remaining cases of generated elements standing among the page's own: the visual-action proxies after each drawing and the hidden external-link note after each external link.

Locally, uv run pytest tests and npm run test:runtime pass. With --run-nightly over the render files, the tests that fail here fail identically on main on this machine, apart from load flakes that pass on rerun.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 9 commits September 27, 2026 13:25
The "N comments" note was a hidden button appended inside each commented
block, so it became the block's last child and flipped the page's own
`:last-child`, `:only-child` and `:nth-last-child` rules while a comment
stood: with `.list > :last-child { margin-bottom: 80px }`, one comment on
the list moved the next paragraph up 67px.

The note now stands in the chrome, and the block names it through
`aria-details`, ARIA's relation for an annotation, written with element
reflection so a block inside a widget's shadow tree reaches it too.
`aria-owns` would keep the note in the block's reading order, but Chrome
has no `ariaOwnsElements`, so it cannot cross that boundary. The block's
only trace is the attribute, restored to any authored value when the
note goes.

Behavior that moved:
- A screen reader is told the block has details, rather than reading
  "N comments, button" at the block's end.
- The note is no longer a Tab stop; the keyboard reaches a block's
  threads through `c`, `t` and the margin row. Focus on the note stands
  at its block (a declared side in standing-target.js), and
  `threadEntryAt` now reads that standing place, so the card and the
  Threads list follow it as they followed focus inside the block.
- At rest the note is transparent, pointer-less and fixed under the
  banner, in the skip link's face; focused it shows the skip link's chip.

reach.js no longer excludes the note when asking whether a scroller holds
its own control, and the covered-words and render checks no longer name
it. Gate tests that used the note as the out-of-flow word inside a
scroller now plant a `.lf-quiet` word, the case that containment still
serves. A new test measures the list case above.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A revision that keeps a commented block and changes its own `aria-details`
patched the block's name for its note away, and the note's release then
restored the value from before the revision. The projection now names
the note on every pass where the relation is missing, recording the
source's value then.

The note's resting rule moves inside the chrome's @scope, since the note
lives in `.lf-chrome` and the global class list is the widget contract.

`threadEntryAt` reading the standing place also reaches a margin cluster
control: with Threads open, `c` on a target's marker now continues the
thread the list expanded for it, as the glossary's Standing target says
every side answers alike. Before, the list expanded that thread and `c`
started a new comment. The Threads test runs from both sides.

The module header now says what the relation does and does not give a
screen reader, and the stale comments that placed the note in shadow.css
or inside its block are corrected.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…kes no pointer

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The notes now stand together in the chrome, where a screen reader
meeting them in order heard a row of identical "N comments" buttons with
nothing saying whose each was. Each note is now named as a thread's quote
names its block, cut to a spoken name's length (`spokenSubject`):
"2 comments on § paragraph · The first passage…". It still shows only the
count, which the name begins with.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a6d3190 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the comment-note-out-of-flow branch September 27, 2026 22:00
max-sixty added a commit that referenced this pull request Sep 28, 2026
…1389)

Follows #1356, which moved the hidden comment note out of commented
blocks. A sweep of every example page (an init-script MutationObserver
recording each element the runtime adds under an element the page wrote)
found three more runtime elements standing among the page's own, where
they change which child a page rule finds first, last, or next
(`:last-child`, `h2 + p`) and so move the page's content
(`skills/leaf/assets/AGENTS.md`, "Space and scrolling"). This removes
all three and adds a nightly check that keeps it that way.

**External links.** The hidden "opens in a new tab" span after each
external link is gone. The arrow mark already inside the link carries
those words as its `aria-label` and the link's `aria-describedby` names
it; it stays `aria-hidden`, so the link's name is unchanged. Chrome's
accessibility tree reads the same description.

**Contents (`lf-toc`).** An id-less heading (or the start row's
`h1`/`main`) is lent an `lf-` id instead of getting a zero-height span
inserted before it. The theme's `.eyebrow + .lf-toc-target + h2`
workarounds and go-to-sequence's handling of an aria-hidden fragment
sentinel are deleted. A row's link follows its destination's id when a
revision adds or removes one. `ADDRESSABLE` becomes the one reading of
"an id the page wrote": passage capture, version comparison,
reading-place capture and the render checks' element names used looser
selectors that would have taken the lent id for an address (capture
recorded it as a comment's section; a test covers that).

**Drawings' response proxies.** The hidden "Respond to …" buttons were
inserted after each drawing. They and the comment note now go through
one owner, `runtime/details-shelf.js`: a note about an authored element
stands on one fixed shelf in the chrome, and the element names it
through `aria-details` (element reflection, so it reaches from shadow
trees), keeping the page's own `aria-details` ahead of the notes and
restoring it when the last note goes; a revision's patched value is
recognised by the content attribute, which the relation leaves empty. A
drawing's proxies are one named group there.

What moved for users: the proxies are no longer Tab stops, since from
the chrome they would come after the whole page. The keyboard reaches a
drawing and each declared part through `s` (the target chooser); a
screen reader through the drawing's details relation, and focusing a
proxy still reveals and scrolls to its drawing. How screen readers
announce `aria-details` varies; the tests check Chrome's accessibility
tree, not a screen reader.

**Nightly check.** `test_page_fixture_renders` (the corpus sweep,
nightly) now also runs the probe `apparatusAmongAuthored`
(`render-checks/framing.js`): any `.lf-ui`/`[data-lf-gen]` element
standing as a child of the page's own block markup under `main`, outside
widgets (inside markup containers such as tab panels it checks again).
It fails on the previous proxy placement (heat-loss, security-boundary).

Tests: `uv run pytest tests` and `npm run test:runtime` pass. With
`--run-nightly` over every render file, each failure was rerun on this
branch and on the merge base side by side; all reproduce on the base.
The aim sweep
(`test_every_control_the_layer_offers_is_a_box_the_user_can_hit`) now
skips boxes that take no press, since the resting proxies sit in the
chrome where buttons read a pointer cursor.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants