Skip to content

Offer a link to each section from its heading - #3836

Merged
max-sixty merged 4 commits into
mainfrom
heading-links
Oct 25, 2026
Merged

max-sixty merged 4 commits into
mainfrom
heading-links

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A reader can now copy a link to any section the page gives an address, on leaf.page and on every Leaf page. Hovering a heading shows a link mark in the gutter before its first line, or at the heading's far end where the gutter has no room, as on a phone. Pressing it copies the page's URL ending in the section's fragment, such as https://leaf.page/how-it-works/#communication-commands for "Agent command inventory". A tap on a heading shows the mark, and a second tap on it copies. Enter on the heading or the section it opens copies too, and the command reference lists the command there; a link inside the heading keeps its own Enter. The control stands in chrome, takes no room and changes no page markup.

A heading's address is the outermost authored addressable it titles, by the rule that already names an element after its leading title, so addressable-names.js now exports leadingTitle as the element. A heading with no id on itself, its <hgroup> or the section it opens gets no link, and a revision that removes the address takes the link away. page-authoring.md ("Stable anchors") tells authors this.

The guard that stops a revealing tap from also pressing a newly shown control moves from code-copy.js to block-controls.js (pressedElsewhere), which both controls use.

A keyboard user reaches a heading's link only after landing on its section, for example through a contents link; the Page Map and g hints don't offer headings yet.

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

max-sixty and others added 3 commits October 24, 2026 14:04
A reader can now copy a link to any section the page gives an address. A link
mark stands in the gutter before the heading's first line, or at its far end
where the gutter has no room, as on a phone. It shows under the pointer, on a
tap, or while the user is on the heading or its section, and its press copies
the page's URL ending in the section's fragment. Enter on the heading or the
section copies it too, and the command reference lists it there. The page
markup is unchanged and the control takes no room.

A heading's address is the outermost authored addressable it titles, by the
rule that already names an element after its leading title, so
`addressable-names.js` now exports `leadingTitle` as the element. A heading
with no id on itself, its hgroup or the section it opens gets no link.

The press guard that keeps a revealing tap from also pressing Copy moves from
code-copy.js to block-controls.js, which both controls share.

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

Enter copies a section's link only while the user is on the heading itself
or the section it opens, so a link inside a heading follows on Enter again.
A revision that keeps a heading but removes its address now takes the
heading's link control away instead of leaving one that copies nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/code-copy.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-surfaces.js
leaf-agent
leaf-agent previously approved these changes Oct 25, 2026
@max-sixty
max-sixty merged commit f00911e into main Oct 25, 2026
3 checks passed
@max-sixty
max-sixty deleted the heading-links branch October 25, 2026 02:37
leaf-agent added a commit that referenced this pull request Oct 25, 2026
The elevation audit now enumerates CSS declarations with `item(i)`. The
`@position-try` rule added by #3836 exposes `CSSPositionTryDescriptors`:
spreading it yields undefined entries in Chromium, so the audit crashed
at `name.startsWith('--')` in [main
CI](https://github.com/max-sixty/leaf/actions/runs/40155166106). Indexed
`item(i)` reads the actual property names for both descriptors and
ordinary style declarations.

This keeps the section-link behavior and the elevation assertions
unchanged. The failing browser test reproduced on current main and
passed after the change:

```sh
uv run pytest tests/browser/controls/test_theme_and_device.py::test_every_lift_names_one_of_the_theme_s_heights_cast_in_the_scheme_s_ink -q -n0
```

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
The words watch lets typed words go on a press elsewhere, and
input_work_watch.js names which input caused each change. A press moves
focus as its native default, after its own listeners return, so the
blur that move dispatched ran with no source: a box that closes on
blur, as the file tree's search does (Pierre's `onBlur` calls
`closeSearch`), was reported as words leaving the screen with no key or
press, though the user had pressed elsewhere.

`test_presses_and_fills_leave_no_element_naming_stale_keys[file-tree-input]`
hit this once #3836 added Copy link buttons to the page and reshuffled
the sweep's seeded steps: it fills the tree's search, then presses the
panel's Threads chip. The gap predates that PR.

A trusted blur, focusout, focus or focusin dispatched outside any
callback now takes the source of the gesture still finishing its
dispatch. Tab's focus move is credited to its keydown, which the words
watch still treats as moving the user only, so a box that closes when
Tab leaves it is still reported, as is a blur no input caused.
`test_words_a_box_closing_on_blur_is_put_away_only_by_a_press` holds
all three.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
A heading's link stood at the heading's far end once a window had been
narrowed to a phone's width and widened again, even where the gutter had
room for it, and stayed there until reload. #3836 chose between the
gutter and the far end with `position-try-fallbacks`, but every engine
keeps the fallback it last took until that one overflows too (CSS Anchor
Positioning, "last successful position option"), so the far end, which
always fits, was never given up. The render gate's resize journey read
it as the link's box differing at the same width on the way back, on
seven corpus pages.

The control now computes its place from the gutter's room alone, in its
`right` inset, so its place depends only on the current width. Firefox
155 left a `left`-inset control where its heading stood before the
window widened, so the `right` inset carries the arithmetic. At every
width a fresh page shows, the link stands where it did before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3939)

Adds a nightly macOS run of every test tier, and fixes every test that
failed in its first run or in the Linux nightly beside it: 89 tests in
[run
40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
60 of them only on macOS.

## The macOS nightly

`ci.yaml` gains a `test-macos` job: every tier on `macos-15`, `-n 2` on
its three cores, in the daily schedule and a dispatch. It belongs to
`ci`, so a failure turns that run red and reaches tend through the
existing `workflow_run` trigger, with no tend configuration change.
GitHub doesn't bill hosted runners for public repositories; the job
holds one of the account's macOS slots for about three hours. The test
step names `shell: bash`, without which a step runs without `pipefail`
and piping pytest through `tee` reported the first run's failures as a
green job. The setup action's Ubuntu mirror step now runs only on Linux.

`tests/AGENTS.md` counts `test-macos` among what tend repairs and leaves
only failures no CI run shows to local sessions. It drops the
instruction to confirm a macOS-only failure at normal priority because
`taskpolicy -b` slows headless Chrome: a test that fails on a slower
host depends on timing, and the fix is to the test. `running-tend` tells
the session fixing a red run, which has only a Linux runner, to verify a
macOS-only fix by dispatching `ci` on its branch.

## The fixes, by cause

Product fixes:

- A drafted margin card rose against the window's foot and never came
back as the draft shrank (#3524). It now holds the top it opened at and
drops back.
- A tapped pin reseated 11px lower as it unfolded, because the
hold-to-read toggle was pressed before the browser focused it (#3341).
- A page's first thread card could cover its passage, because the
placement that makes room was dropped while Floating UI loaded (since
#1526).
- A heading's "Copy link to section" stayed at the heading's far end
after the window narrowed and widened, since every engine keeps its last
`position-try` fallback (#3836). It now picks its place from the current
width.
- Putting the response bar away moved focus off the button the press had
just focused, so the next `e` found nothing (#3756).
- A trace's image-tools status shared a class with the image's loading
notice, whose rules hid it (#3707).
- WebKit scrolled the outer page 1,386px when a sample editor took focus
(#3634).
- In draw mode a press left the previous press's release timer pending,
so a fast second click reached the page.
- Hint refreshes read the geometry of every target inside a closed
disclosure, forcing layout of skipped content.
- A sidebar page's sticky track clipped focus rings (#3918). A stuck
track body now keeps the ring's room inside its edges, so its blocks
stand 5px in from each side.
- Tab revealed a block's Copy flush with its scroller, cutting its ring
(#3916).
- The hidden "my change" word inside a choose group took a cell's
padding and read as clipped content (exposed by #3837's check).
- Visual review case buttons kept their wide padding after the first
breakpoint crossing, a Chromium restyle bug avoided by making the case
list a plain container.
- A held shot's scrolling stage didn't declare that it holds its height
(#3703/#3704).
- When the log refused a reply, the floating panel's head moved down
69px and the restored draft pushed its controls up 21px (#3400). Through
a refusal the panel now holds its head and the field its height, on the
holds a press already takes; the refused turn's room goes at the user's
next turn.
- A reply box's ↑ (edit your last message) appeared only after an
unrelated repaint once its last message became editable (#3855). Every
message draw, by any thread reader, now recomputes that row's keys.
- A trace's images took the page's scroll anchor, so a lane change in
the timeline scrolled the page 62px under an arrow key; they no longer
anchor scroll. The trace overview wrote its window's new start before
reading its size, so for one layout the window ran past its strip and
Chromium scrolled the page up to 838px; it now reads before it writes.
The image tools' status keeps its line when its text clears.
- Web Awesome's radio group moves focus on an arrow with a bare
`focus()`, which Leaf's ring scroll margin turned into a page scroll.
The vendored bundle is patched (`build/vendor.mjs`) so both calls pass
`preventScroll`.
- A Leaf page inside an iframe took focus from the page around it when
it finished arriving. Its arrival recovery now runs only at top level or
in a frame that holds focus.
- The margin rail's one Tab stop stayed on whichever row last held it,
so a resize could leave it below a row the user sees first. It is now
the highest row in view; a focused row keeps it.
- A resize that moved a sidebar page's track into the page, with neither
place made by the reader, took the track's place over the page's:
live-progress jumped 1861px (#3918). On a tie the page's own place wins.
- The whole-page rule read a shut disclosure whose children are all
generated as showing what it holds (#3908); it now skips only `.lf-ui`
apparatus.
- The gallery revealed its stamped frame at the centre, carrying the
pressed button 45px; it now scrolls only as far as needed.

Test fixes:

- The Codex fixture copies the running interpreter as `codex`; on a
framework Python, as on the runner, the copy fails its code signature
and macOS kills it at launch. That broke 39 tests. The copy is now
re-signed ad hoc, and the fixture no longer leaks `PYTHONHOME` into the
command it runs.
- The plain-HTTP copy test missed Chromium's lower-cased host; the
event-door refusal test read its answer after the server's reset; the
stale-keys sweep raced the browser entering fullscreen; the words watch
didn't credit a blur from a press elsewhere.
- Several tests read state before it settled (a shown gesture's arm, a
side list's smooth scroll, a sample's focus returning, a held reply's
menu), and now wait for it. Assertions predating #3830, #3916, #3670,
#3673 and #3217 now read the current behavior.
- Three waits fixed their own deadline instead of the suite's, among
them the async-probe test's 500ms.
- The command hub's record now sticks in view, so the Atlas journey
opens its news before reading each row; the region-capture journey drags
over the unreadable image it means to fail on (#3861 draws only the
element that alone paints the crop).
- The touch-capture removal test, which fails intermittently on main,
now reads the shelf right after the tap and names the elements the tap
reached, so its next failure says whether the tap missed or the image
came back.
- The feature-gallery scroll pass allows a third of its steps to write
the contents' `aria-current`, as gestures already do, since the count
depends on where sections fall under the platform's fonts.

The branch also merges the four open `grind/f-main-tests-*` pull
requests, whose fixes cover five more of the run's tests: #3871, #3882,
#3887 and #3906. This pull request lands them.

Each fix was reproduced failing and then passing by node id, on this Mac
or, for a Linux- or runner-only failure, against a run's log, except
where its commit says otherwise. Dispatched full runs on this branch
([40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
[40186545420](https://github.com/max-sixty/leaf/actions/runs/40186545420),
[40196342887](https://github.com/max-sixty/leaf/actions/runs/40196342887))
check both platforms; the second took the macOS job from 86 failures to
38, most of the rest fixed since. A few macOS-only failures pass on
every local attempt (two reading-place tests, a scroll repaint, Back
from a thread, opening a line under the last, the Android composer's
Return, margin-entry order, a card paging on, a turn arriving out of
view) and have no fix here; once this lands, the macOS nightly reports
them to tend.

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

---------

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