Repository navigation
Give copying, thread names, label words, tree order and style writes one owner each - #5295
Merged
Merged
Conversation
The browser runtime answered several questions in more than one place, and
the copies had drifted. Each question now has one owner that every caller
asks.
Whether the page can copy. copy-control.js exports `canCopy`: the Clipboard
API, or, on a top-level page, the selection command the control already falls
back to. The control's click guard and the leaf's menu both ask it. Before,
the menu asked only for the Clipboard API, so a page read over plain HTTP from
another machine (`leaf --host` on a tailnet name) hid Copy link although the
control could copy there. The menu now offers it. A secure page without a
Clipboard API also copies through the selection now, where the control used to
let Web Awesome fail.
Thread names. `threadNames` in thread/model.js also indexes each thread's key
(its root's attempt, else its id). A raw attempt is 32 hex digits or one of
the server's prefixed names, and a logged id is 8 hex digits, so a key can't
name another thread. The linear scans in thread/destination.js,
thread/held-news.js, thread/focus.js, thread/actions.js, thread/surfaces.js,
queue-title.js and the floating panel's `threadByKey` now ask `threadNamed`.
Those that read only the discussed threads keep that filter with `discussed`.
`allThreads` now selects `effective.thread.all` rather than the whole thread
state, so a renderer that asks `threadNamed` doesn't repaint when only the
tab's list of gestured threads changes. Behaviour change: a check that matched
one spelling of a thread's name, such as the reply carry's check that its
thread still stands, now finds the thread under any of its names, including
across the log's answer to a thread this tab started.
Tree order and hosts. obligations/view.js and
annotation-overlay/margin-projection.js ask `renderedOrder` instead of
climbing to a host and calling compareDocumentPosition, which removes the
comment explaining Chrome's order for disconnected nodes. `hostIn` moves from
shadow.js to shadow-tree.js, shadow.js re-exports it, and `focused(tree)`
calls it.
Words. words.js gains `counted` and `capitalized`. `labelWords` replaces the
whitespace collapses in visual-parts.js, obligations/answer.js,
anchor-resolution.js, keyboard/command-reference.js and composing/dictation.js;
JavaScript's \s is the kernel's collapse class, so their words don't change.
The count helpers in semantic-news.js, thread/held-news.js and the floating
panel, their inline copies, and the `capital` helpers and inline
capitalizations call the owners. Every caller says the same words as before,
at zero too. dom-children.js keeps its own collapse, since it is a runtime
primitive and may import no owner.
Small owners. The floating panel reads `coarsePointer` from pointer.js,
history.js races `aborted` from abort.js, composing/page-image.js uses
`overlaps` from rect.js, and passages.js exports `HEADING` for the heading
selectors in heading-links.js, reading-place.js, addressable-names.js and
thread/placement.js, and `GENERATED` for annotation-inventory.js.
Style writes. Setting an inline style property to the value and priority it
holds, or removing one that is absent, produces no mutation record and leaves
the style attribute as it was in Chromium 156, Firefox 157 and WebKit 27.2,
measured with a Playwright page that observed setProperty, removeProperty and
property assignment. The guards that read a property before setting it are
deleted from heading-links.js, block-controls.js, thread/reply-continuity.js,
prepaint.js and the lf-tabs, lf-text-document, lf-trace and timeline widgets.
The keeps.js header states the measured rule, and the question index in
browser/AGENTS.md points to it beside the new owners' rows.
keyboard/layer-stack.js keeps `closest(".lf-chrome")`. It asks whether the
chrome's light-tree rules style a dialog where the dialog stands, and a shadow
boundary does stop those rules, so `inChrome` would answer a different
question.
Tests. test_the_share_link_shows_where_it_can_be_selected_without_a_clipboard
asserted that the menu hides Copy link without a Clipboard API.
test_copy_link_is_one_press_over_plain_http replaces it: over plain HTTP the
menu offers Copy link and the press copies the link. It fails on the previous
runtime. `over_plain_http` in render_harness.py replaces the loopback route
that the About and code-block plain-HTTP copy tests each set up.
…n the page The menu now sends Copy link over plain HTTP through the copy control's selection fallback, which is how an iPhone reaches `leaf --host` on a tailnet name. Its helper field was editable, at the default font size, and selected with `select()`. iOS Safari raises the keyboard for an editable field, zooms into one smaller than 16px, and can select nothing on `select()`, after which the copy fails and the menu opens About. The field is now read-only at 16px and selected with `setSelectionRange`, as clipboard.js and copy-text-to-clipboard do. The iOS simulator probe can't confirm a tap there: it serves a secure page, and its WebDriver taps deliver no click. The margin cluster's arrival asks whether the user came from after it. The node they left may already be out of the page, and `renderedOrder` between a connected and a detached node has no meaning, so a departed node now counts as coming from before, as the old host climb answered. The removeProperty and visibility guards left in thread/reply-continuity.js, keyboard/key-badge-placement.js, keyboard/chip-seats.js and annotation-overlay/surface-grip.js go, by the measured rule the keeps.js header states.
# Conflicts: # browser/runtime/copy-control.js # dist/kernel/kernel.json # dist/kernel/leaf.js # dist/kernel/runtime/bundle-content-layout.js # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-errors.js # dist/kernel/runtime/bundle-page-layout.js # dist/kernel/runtime/bundle-passages.js # dist/kernel/runtime/bundle-portable.js # dist/kernel/runtime/passages.js
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-page-layout.js # packages/playwright/widgets/timeline.js # tests/browser/test_render_floating_panel.py
…heir owners #5244 and #5242 have landed, so three questions they held open now have one owner that every caller asks. A drawn thread's id. Seven readers spelled `data-lf-thread` themselves beside `drawnThreadId` in thread/selectors.js: thread/held-news.js, thread/reply-continuity.js, thread/surfaces.js twice, annotation-overlay/thread-preview.js, and annotation-overlay/margin-projection.js twice. Those that read one element's id now call `drawnThreadId`. Those that looked up the page threads drawn with an id call the new `drawnThreadsWithId` beside it, which queries `.lf-page-thread` by the escaped id as they did. The floating panel's `.lf-fp-asked` outlets keep their own `data-lf-thread`: it holds a thread's key on an outlet, not the id of a drawn thread. A page of parts' views. content-layout.js found the parts container itself: `body > main`, the `--lf-layout-box` test and the `[data-lf-views="parts"]` selector, all of which passages.js's `layoutBox` already reads. passages.js now exports `layoutParts` beside `layoutBox`, both read one selector constant, and content-layout.js's title marking calls it. Whether the user can scroll a box. box-motion.js tested `auto|scroll` against either axis and against overflowY, and scroll-containers.js tested it against overflowY. Each now asks geometry.js's `userScrollport`, which answers the same for every overflow value. Neither module crosses a boundary by importing geometry.js: dependency-cruiser finds no cycle and no closure rule against it. browser/AGENTS.md's question index names `drawnThreadsWithId` and `layoutParts` in their rows. No behaviour changes, so no test changed.
leaf-agent
previously approved these changes
Nov 4, 2026
# Conflicts: # dist/kernel/kernel.json # dist/kernel/leaf.js # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-box-motion.js # dist/kernel/runtime/bundle-content-layout.js # dist/kernel/runtime/bundle-data.js # dist/kernel/runtime/bundle-dictation.js # dist/kernel/runtime/bundle-errors.js # dist/kernel/runtime/bundle-page-image.js # dist/kernel/runtime/bundle-page-inspection.js # dist/kernel/runtime/bundle-page-layout.js # dist/kernel/runtime/bundle-passages.js # dist/kernel/runtime/bundle-portable.js # dist/kernel/runtime/check-api.js # dist/kernel/runtime/passages.js # dist/kernel/runtime/widget-api.js
leaf-agent
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the 2026-11-03 sweep for duplicate implementations (#5291 changes how review and Tend look for them). The browser runtime answered several questions in more than one place, and the copies had drifted. Each question now has one owner that every caller asks, and
browser/AGENTS.md's "One answer for each question" names it.canCopy: the Clipboard API, or, on a top-level page, the selection command the control already fell back to. The control's click guard and the leaf's menu both ask it. The fallback's helper field is now read-only at 16px and selected withsetSelectionRange, as clipboard.js and copy-text-to-clipboard do, since iOS Safari raises the keyboard for an editable field, zooms into one under 16px, and can select nothing onselect().threadNamesin thread/model.js also indexes each thread's key (its root's attempt, else its id), and the linear scans in thread/destination.js, held-news.js, focus.js, actions.js, surfaces.js, queue-title.js and the floating panel'sthreadByKeyaskthreadNamed. A key can't name another thread: an attempt is 32 hex digits or one of the server's prefixed names, and a logged id is 8.allThreadsselectseffective.thread.all, so a renderer askingthreadNameddoesn't repaint when only the tab's gestured threads change.data-lf-threadbesidedrawnThreadId; those reading one element's id call it, and those finding the page threads drawn with an id call the newdrawnThreadsWithIdbeside it in thread/selectors.js.renderedOrderinstead of climbing to a host and callingcompareDocumentPosition. The margin cluster's arrival counts a node that has left the page as coming from before, sincerenderedOrderbetween a connected and a detached node means nothing.hostInmoves to shadow-tree.js, andfocused(tree)calls it.countedandcapitalized, andlabelWordsreplaces the whitespace collapses in visual-parts.js, obligations/answer.js, anchor-resolution.js, keyboard/command-reference.js and composing/dictation.js. Every caller says the same words as before, at zero too. dom-children.js keeps its own collapse, since it is a runtime primitive and may import no owner.layoutPartsbesidelayoutBox, both reading one selector, and content-layout.js's title marking calls it instead of re-derivingbody > main, the--lf-layout-boxtest and the parts selector.coarsePointerfrom pointer.js, history.js racesabortedfrom abort.js, composing/page-image.js usesoverlapsfrom rect.js, passages.js exportsHEADING, which heading-links.js, reading-place.js, addressable-names.js and thread/placement.js each wrote, andGENERATEDfor annotation-inventory.js, and box-motion.js and scroll-containers.js ask geometry.js'suserScrollport.setProperty,removePropertyand assignment. The guards that read a property before setting it are gone from heading-links.js, block-controls.js, thread/reply-continuity.js, prepaint.js, keyboard/key-badge-placement.js, keyboard/chip-seats.js, annotation-overlay/surface-grip.js and the lf-tabs, lf-text-document, lf-trace and timeline widgets, and the keeps.js header states the measured rule.What changes for the user:
leaf --hoston a tailnet name, hid Copy link although the control could copy there. The menu now offers it, and the press copies the link. The iOS simulator couldn't confirm a tap there: it serves a secure page, and its WebDriver taps deliver no click.Tests:
test_copy_link_is_one_press_over_plain_httpreplaces the test that asserted the menu hides Copy link without a Clipboard API, and fails on the previous runtime.over_plain_httpin render_harness.py replaces the loopback route that the About and code-block plain-HTTP copy tests each set up.