Repository navigation
Give the page walks, the working place and focus readings one owner each - #2682
Merged
Merged
Conversation
The t and q walks each stepped from the user's place by their own copy of the same filter, and the copies disagreed. With the caret in a paragraph a thread is on, `t` skipped that thread and `T` skipped it the other way, while `q` arrived at an item holding the caret. The t walk also compared a light-DOM place with a thread target inside a widget's shadow tree through `compareDocumentPosition`, which calls them disconnected and orders them arbitrarily, and it sorted a thread whose passage no longer resolves at its section but stepped it as if it had no place. `standing-target.js` now owns the step (`stepFrom`): an item whose place holds the user's is the nearest either way, so `t` and `T` open the thread on the caret's paragraph. Both walks read a thread's place as the list sorts it (`threadPlace`, destination.js, from thread/placement.js). Page order is read across shadow trees by `renderedOrder` in `shadow-tree.js`, which annotation-inventory.js already computed for itself; the thread list, the q walk, the page outline Threads labels sections from, the Questions panel's section words and the command reference now sort by it. `walkOrigin` no longer climbs to a shadow host, so places inside one widget keep their order. `placeOf` takes the node the user stands on, inside any shadow tree, and the sides that answered only for light DOM (the Threads panel, the margin card, the details shelf, the Questions list) now climb across shadow roots, so focus inside a widget in a reply still stands at the reply's thread. More held its own copy of the working place and restored raw offsets checked only for `isConnected`. It now reads and returns the place through history.js's `readPlace` and `returnPlace`, which already checked every end against its node's current length. More now holds a collapsed caret too, as Back does, so that check is what keeps a live revision that shortens the caret's text node from making a place-keeping command throw IndexSizeError. `returnPlace` no longer clears the document selection after restoring a field's caret, which had collapsed a textarea's selection on Back. Every reading of focus outside focus.js now asks `focused()`, or `focused(tree)` for the node standing for it in one document or shadow root, which replaces keyboard/scopes.js's `documentFocused`. The new `architecture/standing-reads` lint refuses a raw `activeElement` read elsewhere, save a frame's `contentDocument` and the editor's closed root. Readers that compared `document.activeElement` now see a label press holding the user, and those comparing with nodes in a shadow tree see focus there. A printed key pressed on a checkbox or radio before the runtime loads is now held and replayed, as the presented page would take it: bootstrap.js's typing test spells focus.js's `takesLetters` instead of counting every input as a text field. Four more repeated questions get one owner. Every click handler that read `detail` to tell a keyboard click from a pointer one asks `pointer.js` `pressIsKeyboardActivation`, which packages reach through `widget-api.js`. `control-selectors.js` owns `CARET_KEYS` and `selectsAll`. The hint session declares its Tab/Shift+Tab walk and Enter choose rows once, as `walkRows`. `shadow-tree.js` owns `under`, `renderedUnder` and `composedParentNode`; focus.js, keyboard/dispatch.js and passages.js drop their own climbs. Ctrl/Cmd+Shift+A now keeps the writing caret in a draft, the target picker's choose command is `target.picker.hint.choose`, and `renderedUnder` answers true for a shadow root or document holding the node. Tests: `t`/`T` from a caret on a thread's paragraph open that thread (fail with the old rule); More's Align after a revision shortens the caret's text node (throws without the length check); a `t` held from a checkbox before load (fails with the old typing test); stepFrom, renderedOrder, the climbs and the lint rule under Node. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # eslint.config.mjs # skills/leaf/assets/runtime/banner-toolbar.js # skills/leaf/assets/runtime/focus.js # skills/leaf/assets/runtime/history.js # skills/leaf/assets/runtime/queue-panel.js # skills/leaf/assets/runtime/shadow-tree.js # skills/leaf/assets/runtime/shadow.js
…ins copies Review of the walk change found that once the Threads panel's side climbs across shadow roots, focus deep inside a widget in a panel card passed the margin's light-DOM `panel.contains(active)` guard and could scroll the card under the user. Every `scope.contains(focused())` now asks focus.js `standingIn(scope)`, which climbs as rendered, and the margin's guards read `renderedUnder`. `architecture/standing-reads` refuses `contains(focused())`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Closing the margin card with focus inside a widget's shadow tree in it missed `preview.contains(at)`, so focus fell to the body instead of returning to the card's button. That read and the ten spelled `scope.contains(focused(document))` now ask `standingIn(scope)`, and `architecture/standing-reads` refuses `contains(focused(...))` in either reading. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Oct 12, 2026
The index row named `walkRows`, a method of the session `createHintSession` returns, which the index test reads as a module export. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 12, 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.
Workstream #10 of the duplicate-logic sweep: the
tandqwalks and More's saved place each read the user's place their own way, so stepping from the caret and restoring a place behaved differently by entry point. This gives the walks, the working place, and every focus reading one owner each.What changes for the user
t/Tfrom the caret. With the caret in a paragraph a thread is on,tandTnow open that thread, asqalready arrives at an item holding the caret. Both directions used to skip it. Threads anchored inside a widget's shadow tree now order among the places beside them (the walk used to compare them throughcompareDocumentPosition, which calls cross-tree nodes disconnected), and a thread whose passage no longer resolves is sorted and stepped at the same place, its section, by both walks.history.jsreadPlace/returnPlace, which check each selection end against its node's current length. More (and the floating panel's place-keeping rows, which had their own copy,readStanding) now also hold a collapsed caret, as Back does, so a live revision that shortens the caret's text node no longer makes a place-keeping command throwIndexSizeError.returnPlaceno longer clears the document selection after restoring a field's caret, which had collapsed a textarea's selection on Back.Owners, and where to look
standing-target.jsstepFrom: the one step rule for both walks.shadow-tree.jsrenderedOrder/byRenderedOrder: page order across shadow trees, now used by the thread list, the q walk, the page outline, the Questions panel's section words, the command reference, and annotation-inventory.js (whose copy it was).walkOriginandplaceOftake the node the user stands on, inside any shadow tree; the sides that answered only for light DOM climb across shadow roots.thread/destination.jsthreadPlace: one reading of a thread's place for sorting and stepping.focus.jsfocused(tree)replaces keyboard/scopes.jsdocumentFocused; every rawdocument.activeElementread moved ontofocused(), and every "is the user in this scope" read ontostandingIn(scope).architecture/standing-readsineslint.config.mjsrefuses a rawactiveElementread (save a frame'scontentDocumentand the editor's closed root) andcontains(focused(...)).pointer.jspressIsKeyboardActivation(now exported to packages),control-selectors.jsCARET_KEYS/selectsAll,keyboard/hints.jswalkRows, andshadow-tree.jsunder/renderedUnder/composedParentNode. Ctrl/Cmd+Shift+A now keeps the writing caret in a draft, and the target picker's choose command id istarget.picker.hint.choose.skills/leaf/assets/AGENTS.md"One answer for each question" has a row for each new owner.Tests
t/Tfrom a caret on a thread's paragraph open that thread (both fail with the old rule).IndexSizeErrorwithout the length check).theld from a checkbox before load (fails with the old typing test).stepFrom,renderedOrder, the climbs, and the lint rule under Node.Focused browser selections over the touched surfaces pass locally (about 550 tests), as do
pnpm run test:runtimeand eslint over every file.