Repository navigation
Pointing reads; pressing acts: one owner previews every control - #5614
Conversation
…y and value
Hovering, keyboard focus and a held finger now read one preview, drawn by
runtime/preview.js beside its target in the tooltip face (or the popover face for a
passage of words). It stands in a `popover="hint"` in the top layer, anchored to its
target by CSS anchor positioning, takes no pointer, holds no control and moves
nothing. One shows at a time: after a 200 ms dwell for a pointer (at once when warm),
at once for focus the browser shows, and after the same dwell under a finger, whose
release still presses. Leave, blur, a press, any key (for a pointer's) and Escape put
it away; Escape still takes its own step, so dismissing a preview never costs a press.
What a target previews:
- An element declares `lfPreview()` (module-input.md, "Previews"): words, a template,
`{popover: words}`, or null. No import, so a portable widget reads nothing off Leaf.
- A control previews its accessible name where its face is a symbol, its
`aria-description`, and every key that presses it as `.lf-key-badge` chips, from the
register (`controlKeys` in keyboard/control-keys.js).
- A range's owner calls `pointRange(range, read, at)`, for the passage marks to come.
Every key that presses a control is named. A row that presses another command's button
names it as `control` with no `run`, so the button keeps one command: `r` now presses
Resolve and `Mod+c` a message's Copy that way, and the chosenCommand refusal says so.
Send's preview names the box's send key through `pressPreview`: naming Send as
`text.send`'s control would make Enter unavailable whenever Send is aria-disabled, and
lose the "Nothing to send" announcement an empty box gives.
The platform `title` goes from every control the owner serves: role constructors,
nameAction, closeControl and control-keys no longer write it, and the `{title}` option
is gone. Hand-written key suffixes ("(Esc)", "(⏎)") go with it.
Moved onto the owner, their own handling deleted:
- held-word.js, HOLDS_WORD and data-lf-held-word: the owner's hold covers margin
entries, reactions, a diff's cut path and every other previewing target.
- The margin entry's label and the ⇄ change entry's: the label element, its placement
pass (which measured every entry on the page on every hover) and its CSS. The label
now wraps whole instead of cutting its question to one line, and may cover a
neighbouring entry, which still takes the pointer through it; the test that held
neighbour avoidance is deleted.
- The folded leaf's status peek: hover and focus state, exposure snapshot and the
reading-continuity reset. The peek element stays as the folded panel's notice seat.
- lf-gloss: hover and focus tracking. The phrase previews its explanation; a press
pins the card, where its words can be selected and commented on.
- The trace timeline's tip: its element, anchor, hover handlers and CSS.
- A trace image scale's and pace select's titles became aria-descriptions; the
transport buttons are named "Previous capture" and "Next capture".
Supporting changes: a hint popover joins no layer stack, so the dispatcher tiers no
scope over it and closing it hands nobody back; content-layout no longer re-reads the
document for toggles in Leaf's chrome; a preview of something that arrives under a
still pointer, or one reached while a press is carried, does not show; a hidden tab
hides the preview. The feature gallery's fixed samples suppress their previews through
`lfPreview` instead of a theme rule on the old label.
Docs: browser/AGENTS.md gains "Pointing reads; pressing acts" and reconciles "Controls
are few and quiet"; interface-goals.md, module-input.md, module-authoring.md,
keyboard/AGENTS.md ("Touch routes", "Escape") and the glossary follow.
Tests: test_previews.py holds a control's word and key chip, that it moves nothing,
the focus route, Escape, and a range's placement. Tests that read the margin label,
the peek, held words, the trace tip, titles and the diff path's generated word now
read the preview; a stills state, control-preview, shows Resolve's.
…e per hover
A fresh look at the first round's captures, a code review, and four branches building
on the owner (thread previews and ages, link previews, chart values) found five
layouts, a dismissal that cost the open thread, tooltips crowding what they stood by, a
contract that replaced a control's own words, and a rule added to the document for each
widget control a hover reached.
The contract. `lfPreview(route)` is called once as a preview shows, with the route that
asked ("pointer", "focus" or "hold"), and returns `{name, keys, detail, at, excerpt}`,
every field optional: lines under the control's own name and key chips, which `name`
replaces where the accessible name says more than the face should. `at` is where the
preview stands, the declaring element by default: another element, as a message's age
stands by its `<time>`, or a box in client coordinates inside the element, as a chart's
value stands above its point. `excerpt: true` gives a preview quoting a block of the
page, as a link's place, the face's wider room. `null` adds nothing, so the search goes
on outward; `false` shows nothing here or around it, as a pinned gloss card. What a
declaration throws is reported and shows nothing. `previewChanged(element)`
(portable-api.js) says an element's preview changed while the aim stayed on it, as a
chart's pointer reaches another point or a grabbed card's grip goes quiet: a standing
preview redraws in place with no fade, or the route reading the element shows it. The
lf-trace marks, the gloss, the diff row, the margin entries, Send, the leaf and the
board's grip declare this way; the chart, link and thread branches convert from
`{popover}`, bare words and `{words, at}` to it.
A control's own preview is its accessible name where its face shows a symbol or doesn't
say that name, keyed on the face rather than `data-lf-gen`, and the keys that press it.
An options pick ("choose one: Hold approval — option 1 of 2"), a diff gutter number and
a tab no longer preview their screen-reader names, and a hand-built symbol button does.
`aria-description` stays a screen reader's: a diff row's names its path, which the row
shows.
A `title` is an element's words like any other. The portable writers keep writing it
(element-markers.js, `nameAction`), so a widget off Leaf shows the browser's tooltip;
on Leaf the preview reads it on every route, taking it off the element the first time
the pointer comes so the browser shows no second tooltip, and taking it again with new
words when the writer writes another. That moves the thirty-odd titles the runtime and
packages still write onto every route with no edit at each. Holding it off only while
the pointer rested there and putting it back after wrote it twice a hover, which the
write watch flags as an unchanged write and a screen reader hears as the element's
description changing. The cost: a writer's removal of a title already taken removes
nothing, so its words stay until it writes another. Authored markup's titles go the
same way: they gain the keyboard and a finger, at the price of the author's attribute,
which Leaf takes as the one guarantee in play, that every result a pointer reaches has
a keyboard and a touch route.
Escape is a standing preview's own step. While one shows, by pointer or by focus,
Escape puts it away and does nothing else (a `preview` page scope with
`escape: "inner"`, first in the register's STACK); the next Escape takes the step it
stood in front of. With Resolve's preview showing, one Escape had hidden it and closed
the thread card it covered. This follows WCAG 1.4.13 and the WAI-ARIA tooltip pattern.
Any other key still puts a pointer's preview away and does its own work. Focus the
runtime hands back, as a closing surface returns the user to what opened it, previews
nothing, since a preview there would take the Escape the user is backing out with.
The cost, measured on 65 tests that press Escape (48 drawn at random from the 441 that
do, and the 17 named for Escape), each run on this commit and again with the preview's
step turned off: 9 fail only with it, because a focus preview stood on the control
focus had reached when the test pressed Escape, as the Page Map's first row, a margin
card's first control or a thread's Resolve; 7 of them are in the random draw, so about
one Escape journey in seven (Wilson 95% interval 1 in 14 to 1 in 4) now takes one more
press. Not previewing focus the runtime hands back recovered 3 more. 9 others fail with
the step off too, as they do on 6b3159d. The 9 still expect one press and are not
changed here.
One face with fixed slots: the name at the face's weight with its key chips, then each
line of detail in the same type a step dimmer. The popover face for previews is gone:
a gloss previews its phrase and explanation in the tooltip face, and a press pins the
paper card. The folded leaf previews "Unfold Leaf" with its `.` key over the page's
status, and the expanded leaf "Page menu". Trace marks name their moment, input or call
and put its time and checkpoint on lines of their own, and a shared label previews "2
moments" over one line each. Send previews ⏎ and, where Return sends, "New line ⇧⏎".
Words Leaf itself says keep their italic in the detail, as the glossary's voice rule
has them on every seat. A preview on keyboard focus shows at once, with no fade.
Spacing: the preview stands below its target with its end edge in line with the
target's, so a control at a card's edge keeps it inside the card, flipping to the start
edge and above where the window has no room. Its gap is the focus ring's room plus 6px,
so a ring never meets it and the folded leaf's badge has air; a held finger sees it
22px further up. Esc chips: the `close` action in ACTIONS names Escape, and
`controlKeys` reads the action a control shows, so Page Map, About this page, the
thread card's ✕, the visual review's ✕ and the panel's ✕ show it from that one place.
Anchoring: a target in the document stands the preview by the name `anchorName` gives
it, an inline style; a target in a widget's shadow tree, or a box a declaration names,
stands it by one of two places of the owner's own, set over the box by insets from the
nearest box in the document. Naming the shadow-tree box declared a `::part()` rule for
each new one, kept for the session. On pr-walkthrough's 115 shadow-tree controls in
Chromium, a first visit cost 2.3 ms with 69 rules added (1,157 elements) and 5.4 ms with
86 (7,155, the page grown by 6,000 paragraphs); now each show costs 0.3 ms and 1.0 ms
with none added. Moving one name between targets, the review's proposal, cost 1.8 ms and
7 ms per show, since Chromium restyles the page when an anchor's name moves; Firefox
pays nothing either way. Two places take turns so a preview whose anchor changed is
placed afresh rather than first where the last target's fallback put it.
Screen readers: every preview shown on focus describes the focused element while it
stands, whatever supplied it, except a control's own, which says only what its name and
`aria-keyshortcuts` do, and a proxy's; the description it had comes back after, with no
empty `aria-describedby` left behind. `aria-keyshortcuts` now holds every one-press key
its chips draw beside the keys its own scopes take (control-keys.js,
`controlShortcuts`), so Resolve says `r` beside Enter and Space; Send writes its own
from `sendBindings`, the list its chip reads.
Routes: a range's owner may make its range again on every move, which points at the
same range. A key on an element a click focused counts as the keyboard's in Firefox for
a changed preview. A finger held past the dwell reads wherever it slides, so one that
crossed a gap between neighbours reads the next it reaches. The board's grip says its
keys only as chips and its drag in a line of detail, and goes quiet while its card is
grabbed.
The own-command branch in `controlKeys` stays: it serves commands a scope declares
away from the control they claim, such as the image viewer's `z` and its close; its
comment named Send, whose key is the box's own `text.send`, which sends rather than
pressing Send, so the box declares it.
Tests: the preview tests run in Chromium and Firefox; the Escape test fails without the
preview's step; `preview_parts` reads what the pointer route shows rather than calling
`lfPreview()`; the obligation marker measures cuts on the face's box; a focus preview
describes the margin entry it stands on.
Round four of the preview owner, from the decisions on round three and what the link, chart and thread branches found converting to its contract. Focus previews read only where the user moved focus themselves: a Tab or Shift+Tab (the runtime's `step`), or a key that moves them between items while it is down and leaves them in the surface they were in, as an arrow, Home or End does in a list or a widget (`aimed`). Focus a surface places as it opens, as the Page Map's first row, a margin card's first control or a thread's name, focus it hands back as it closes, and focus Escape moves as the user backs out, as from a reply box to its thread, preview nothing, so none stands in front of the Escape the user reaches for next. Escape stays the first step of every preview that stands. On the same 65 Escape tests as round three, 9 failed only because of that step; now 2 do, both where the test Tabbed onto a control and pressed Escape, which is the 1.4.13 cost, and both now press it (test_command_routes, test_escape_from_a_seated_reply_send_returns_to_its_thread). One of the two is in the random draw of 48: about one Escape journey in fifty (Wilson 95% interval 1 in 270 to 1 in 9), where it was one in seven. The 9 that fail with the step off fail on 6b3159d too. Previews are hoverable (WCAG 1.4.13): a pointer's preview takes the pointer, so the pointer can cross from its target onto it and read it there; leaving it puts it away after the dwell, and reaching another target from it shows that one at once. A focus's and a finger's take none. One placement rule for every preview (`stand`, preview.js), measured as it shows and written as insets from the box that carries the target through a scroll (`carrier`): the nearest that scrolls, stands fixed or sticky, or stands in the top layer, else the page's root, each named once. Naming the target wrote its style, which the margin's observer heard: on a page of 512 threads, the first preview on each paragraph measured the margin's 512 boxes; now the first preview of the session measures them once, as the root takes its name, and each paragraph after measures none. Below the box it previews by the gap that clears a focus ring, above where the window has no room, above first for a finger and for a point inside the target; beside a column of targets, toward the nearer window edge, so a margin entry's covers neither the entries above and below it nor the passage it is about, and below a column too wide to stand beside. Along the line it starts at the box's start edge and stays inside the nearest box around the target wide enough to hold it. That replaces the end-edge alignment, which kept a control at a card's end inside the card but pushed an inline target's preview out of its column: a link early in a line of prose (the gallery's trailhead link stood its card at x 28 against a column starting at 168), an age inside a thread card, and a margin entry's, over its passage. It also replaces the CSS position areas, the fallback list and the two places the preview stood a shadow tree's targets by: each show names no target and adds no rule. A target finds its column by a few hit tests around itself, and a target beside it, as a toolbar's controls stand, makes it a row. The contract keeps its shape and adds: - a standing preview's declaration is called again for each new presentation of the document, a state's or a revision's, after it has painted, never per pointer move, so it follows the page, a link's place or a thread's turn, redrawn in place with no fade and left as it is where its words come back the same; a range's preview included, and a range's owner declaring the same range again gives the standing preview its new words, where the same boundaries used to discard them; - `previewChanged` redraws a standing preview in place without the preview closing itself: ending the old record's watch hid it, as `shown` still named that record, so a chart's tip vanished at every other point; - the innermost target wins on every route: a link inside a thread's passage previews as a link to the pointer too, where the passage's owner reported its range after the link's boundary. Titles: every writer that can later remove or blank its title declares its words as `lfPreview` instead, since a removal can't reach words the preview took: the composer's error line, the panel's mode word, menu rows, choice commits and row notices, a deleted message's edit time, command reference entries, the shot view's link and scale words, the file editor's status, the trace's selection label and caption, and the target picker's search status. Writers that only set or replace a title keep it. The words the preview takes live beside the portable writer (element-markers.js, `titleWords`), where the contribution entries and the interaction log now read them, and a frame's title, its accessible name, stays where it is. The long-press menu stays shut only while a held preview shows, so holding a link to another site keeps the platform's menu. Tests: a standing preview stays open through `previewChanged`, follows a new presentation and a new revision, and a standing range preview says its owner's latest words, each failing without its fix; the innermost target previews under the pointer inside a range's passage; the pointer onto a preview keeps it; tests that read focus previews move focus with a key, as the user does; the preview tests run in both engines.
…says who moved it Round five of the preview owner, from the review of 00e9ab5. Placement is the browser's again. The preview is shown with its target as its source (`showPopover({source})`), whose box is its implicit anchor (`position-anchor: auto`), and controls.css stands it there with a logical `position-area` and five `position-try-fallbacks`. That deletes `stand`'s insets, the carrier it named and the container clamp. The preview now follows its target through a scroll inside the page and a resize, starts at a right-to-left target's right edge, and writes nothing on the target, its root or a box that scrolls it. So the margin no longer lays out again for a first preview: on the 512-ask scaling page a paragraph's first preview made 3 rect reads, where round four made 22,543, and wrote no style or class outside the preview. A target with no HTML box of its own (a range's line, a declared box, a shape in a drawing) is stood for by the place, a box in the chrome that scrolls with the page. The module still picks the side, by a few hit tests across the room each side offers: below, above, then beside toward the nearer window edge, the first that fits and covers no other target, so in a 2x2 grid the preview covers no neighbour and the pointer reaches the one below. Where every side covers a target, the preview stands below and the pointer passes through it. A preview taller than the room on either side is held to the room below or above, with its face scrolling, through the window's resizes. Inside a modal dialog it stands in the topmost dialog, carrying the chrome's styles into the dialog's shadow tree where it is in one (layer-stack.js, `carryChromeStyles`, which `seatModal` now calls too), so the pointer can cross onto it there. A hint now expands no control: the layer stack set `aria-expanded="true"` on a popover's `source` whatever the popover was, so a preview shown by the Leaf button announced the panel as open, and the button's own render wrote the value back. Two engine gaps shaped it, both in notes/browser-support.md. Firefox 157 stands a popover shown by a new source by its last source while nothing about the popover changed, so a new source that comes with the same words moves the preview to the other side of the place. Chromium 156 tries no sixth fallback, so the list holds five. Titles: this reverses the call that the preview takes over `title`. The preview no longer takes an author's title off its element. A pointer over an element the browser's tooltip speaks for gets that tooltip and no preview; focus and a finger read the title's words in the preview. Removing a title therefore leaves no words behind, and a control named only by its title keeps that name. The takeover, its cache (`takenTitles`, `titled`, `titleWords`, `takeTitle`) and the readers moved onto it go. Leaf's own symbol controls write no title on Leaf (element-markers.js `titlesName`, read by `nameAction` and the symbol and mark roles); off Leaf they still write one. The compose box's alternate Send drops its title, which repeated its face. Leaf's other titles, such as the held-news notice, panel notes and message times, now show the browser's tooltip to a pointer. Focus previews read who moved focus, not which keys are down. A Tab, Shift+Tab or a placement standing in for one (`step`) shows one, as do a keyboard walk landing (`beginWalk`) and a move a Leaf command the user invoked makes in its own run (dispatch.js `commandRunning`), unless that move enters a surface as it opens or is Escape's step backing the user out, as from a reply box to its thread. A script's focus while Shift is down shows nothing, and an `m` walk onto a margin card's message shows that message's preview. A preview the user put away stays away until they aim again: `previewChanged` redraws a standing preview and opens none on focus, so a board grip released after Escape, or a chart redrawing with the same point, no longer revives one. When a preview goes, whatever puts it away, the element that declared it hears `lf-preview-ended` (`PREVIEW_ENDED`, portable-api.js), a `CustomEvent` whose `detail.route` names the route that read it, so a widget takes off a mark it drew for the reading. Tests: a preview writes nothing on the page and brings no margin pass; it covers no grid neighbour and takes the pointer inside a modal dialog; one put away stays away through a widget's redraw, script focus and a grip's release, and the declaring element hears that it ended; a title stays its writer's; and a preview stands by its target through a scroll, a resize and right-to-left text, and is held inside a short window. All run in both engines. Tests that read a focus preview now step onto their target with the keyboard (render_harness.py `tab_onto`); the cluster test drops a script focus that no longer reads as the user's aim. The panel's Done asserts its preview's words instead of a title. The symbol tests check that no title is written on Leaf and that one is written off it.
A preview may declare a list, `list: {items, more}`, as the threads standing at one
place. Where the list is taller than the room the face is held to, the owner shows as
many items as fit and, under them, `more(count)`'s words for the rest, such as "and
26 more threads" (preview.js `fitList`). It fits the list again as the face's box
changes with the window (a `sizeObserver` on the preview). The items it leaves out
stay laid out but `visibility: hidden`, so they are neither seen nor read by a screen
reader, and the face's size, and with it the browser's choice of where the preview
stands, holds. Each place is written once per fit. A list's face clips; every other
preview's face still scrolls. This replaces the `fits` flag the first round-five
commit added and a consumer's own `overflow: clip` rule, so fitting has one owner.
Test: a 30-item list in a 260 px window shows the items that fit and counts the rest,
inside the window, and shows them all with no count once the window is 1400 px tall,
in both engines.
The module reference spelled the count function inside a double-backtick code span, which the export-documentation test reads span by span; the example is now the words it gives.
A focus preview showed where a Leaf command moved focus during its own run (`commandRunning`), which inferred the user's aim from timing: a widget placing focus as a move after a microtask showed none. The cause its mover passes says it: a Tab, Shift+Tab or a placement standing in for one (`step`) and a move to a place (`move`) show the preview, short of a move that enters a surface as it opens; a return shows none. `commandRunning` and the dispatcher's wrapper around each command go, and so does the preview's listener for a walk's landing (`lf-walk`), since every walk places its landing as a move. Nothing else read either. Coming back out of a thread's box onto the thread, by Escape or a send, is now always a `return` (thread/landing.js), as its comment already called it: it was a move where the thread fitted, which would have shown the thread's preview in front of the next Escape. It still brings a thread that fits into view; its ring paints a frame later, as every return's does. A page script's own `focus()`, which the runtime reads as a move, shows the preview where the browser shows the ring. The test that held focus while Shift was down now places focus as a move after a microtask and expects the preview.
…no scrolling Placement had two deciders that disagreed. The side test checked a box it predicted, and CSS fallbacks then drew another. Near the right edge, JS tested a box at x 703 while CSS drew it at x 651. A bounded preview tagged "above" was drawn below, over its neighbour, and a small control between the six sample points took no test. Now the owner alone decides, from the box the browser will draw, and the browser draws exactly that. The preview is placed with `anchor()` insets (`data-lf-y`, `data-lf-x`, `--lf-preview-room`) and has no `position-area` and no fallbacks. The side is the first that holds the whole preview inside the window and covers no other target: below, then above, each from the box's start edge and then its end edge; beside, toward the nearer window edge first; then centred across the window. Coverage is tested every 23 px across that box, so any target of WCAG's least size, 24 px, is caught. Test points inside the holder's own box are skipped, since they find only the holder or what it holds. A standing preview whose box moves, as a chart's does point to point, keeps its side while that side still holds it, at the cost of one test of the new box. A presentation now places the preview again with what it says, so a declaration whose `at` moves to another element under the same words moves it too (#12). Every anchor is an element. A range's line anchors to the element holding the range, a declared box to the declaring element, and a shape to its drawing's HTML host. Each box is held at its offsets inside its element (`--lf-preview-inset-*`), so the preview follows the element through an inner scroll. It is placed again as the element resizes (a size observer whose first reading moves nothing) and as the window resizes. The place box, a copied rectangle, is deleted. No preview scrolls. One taller than its room shows the lines that fit, hides the rest from sight and from screen readers (`visibility: hidden`), and ends the last kept line with an ellipsis. A list says its count at the foot instead. Pressing the target reaches the rest. An author's `title` read on focus or hold has no press that shows it, but the attribute stays on the element, so the browser's tooltip and a screen reader still give it whole; only a sighted keyboard or touch reader of a very long title loses its tail. The room is what the window leaves, with no 8em floor, so a window shorter than the preview still holds it. The preview's rules move from controls.css into the chrome sheet's `.lf-chrome` scope (chrome.css). That sheet is the one `carryChromeStyles` adopts into a shadow tree, so a preview in a shadow root's modal dialog is now dressed and placed, where it was drawn as a bare popover. Only the preview's face fades now. Its box is anchored, and Chromium 156 places an anchored box that fades again in every frame of the fade, laying out the page's root, a cost that grows with the page. Warm margin-entry hover, measured the reviewer's way in Chromium (thread ticks less idle, median of five): 8.4 to 5.2 ms at 32 asks and 17.4 to 12.5 ms at 512, with 9 layouts per hover where there were 15. Without any fade it is 4.6 and 13.3 ms, so the content-only fade costs the face's own frames. Tests: a preview stands where a 24 px control under the middle of its room is covered by nothing, and holds itself inside a 150 px window with its lines fitted. Held previews are checked for a cut rather than scrolling. The status test reads the face's background and its fade. The range scroll test allows Firefox a few frames to carry an anchored box after its own scroll under load, and the resize test checks the gap that the window's resize keeps, not the side.
`previewChanged(element, {aim: true})` says the user aimed at something new inside
the element, as a chart's pointer or arrow key reaching another point. The new target
shows its preview whatever put the last one away, to the pointer, the keyboard's focus
or a finger. A plain `previewChanged(element)` stays a redraw: it never revives a
preview the user put away and opens none on focus.
Tests: after Escape, an aim inside the element shows its preview again. A command
that opens a surface with focus in it, `m` onto the question waiting on the user,
shows no preview on the focus the surface placed, even where every focused element
previews, and Tab inside the card shows one.
…itles preview A standing preview is read again at each new presentation, which made an age in it follow the clock whenever a state read landed. The re-read now runs at the moment the preview first showed (presence.js `atClock`, `clockNow`), so a presentation whose only change is the clock changes nothing it says, as the folded panel's status test asks. A real change still shows, with its ages as they were when the preview opened. Leaf's remaining titles become Leaf previews, so the pointer reads them in the preview's face and focus and a finger reach them too: the held-news notice's whole label, the panel menu's notes, the view chooser's label and choice, an option's description, a page row's account, a message's workflow word and its edit time. Message times and the activity feed's ages are left to the thread branch, which already previews them as `<time>`. Tests that read these titles now wait for the preview's declared words (render_harness.py `expect_preview_words`).
The gap reproduces in a fresh context with no Leaf code, for manual and auto popovers, when a popover is hidden and shown again by another source in one task, and a frame between the two fixes it; the entry now records it as a Firefox bug with that minimal page, keeping the preview's workaround. The entry for Chromium's five-entry `position-try-fallbacks` limit goes, since the preview keeps no fallback list.
…h a redraw A preview declaration names what it is about (`about`), and the side test leaves that, and the box the preview stands by, in view. It covers them only where no side leaves them clear. Margin entries pass the passage they stand beside, and a message's edit time passes its message. At 1440 and 1100 px, in both engines, a margin entry with a long label covered its own passage from every entry but the first. Now none does, and none covers another entry: the first stands above its entry and the rest centred across the window below theirs, since below and above cover the neighbours and the side toward the window's edge has no room. Points inside the holder's own box are still not hit-tested, as that skip is a cost bound, not the subject rule: they find only the holder or what it holds. A preview may leave the card its target stands in. There is no clamp to the box around a target, as decided. A standing preview no longer moves when its words change. A redraw of the same subject keeps the corner its words start at, as offsets from the element it stands by, while the preview still fits there and leaves what it is about in view. A new aim (`previewChanged` with `aim`), a new target, or a redraw that no longer fits places it afresh. The folded Leaf button's status peek grew its words on a presentation and moved its first line 72 px; it now stays put. Its whole height is now read from the drawn box where it fits, since `scrollHeight` rounds, and a kept corner rounded that way moved the box 0.4 px. Warm margin-entry hover, the reviewer's measure, Chromium: 6.0 ms at 32 asks and 14.7 ms at 512, 9 layouts each. The side test costs 10 hit tests (0.26 ms) at 32 and 11.75 (1.36 ms) at 512.
A hold is the touch form of pointing, so it reads and doesn't act. This reverses the owner's rule since 7056431, that a hold's release pressed the target it ended on, which browser/AGENTS.md, keyboard/AGENTS.md and module-input.md stated and preview.js's header recorded; each now says the new rule and why the old one went: a finger couldn't read without acting, short of sliding off before letting go, which on touch often scrolls instead. The platforms treat a hold this way: iOS and Android follow no long-pressed link on release, and Android's long-press tooltip clicks nothing. - The release presses nothing, on every target. The owner no longer dispatches a click or focuses the target, and it cancels the touch's `touchend`, so the browser makes no click of it either. Before, a held link was followed, a held thread's Resolve resolved the thread, a held margin entry ran its action, a held diff row folded its file and a reaction choice reacted. A tap still presses. - The preview stands after the release, until the next press: a tap on its target, which presses, or a touch elsewhere or a finger's scroll, which put it away, as iOS's link preview does. Cancelling `touchend` is what keeps it: Chromium light-dismisses a hint popover at the click a touch makes, before any listener, so claiming that click (`claimReleaseClick`) still closed it. - A finger reads after the platform's long press, 500 ms, where it read after the pointer's 200 ms, or as soon as the browser fires `contextmenu`, if that comes first. A press let go sooner is a tap to the browser, which clicks, so at 200 ms a slow tap would have shown a preview and then pressed nothing. Tests: test_previews holds the rule on a link: it stays put through a hold's release, the preview stands until a touch elsewhere, `contextmenu` reads at once with its menu shut, and a 300 ms tap follows the link. The margin-entry, reaction and diff-row hold tests now expect no press on release and the preview standing after it.
# Conflicts: # browser/runtime/floating-panel.js
… change The side decision (`stand`) is now the only one, made again whenever what it rests on may have changed: a redraw, the anchor resizing, a declared box or a range's line moving inside its element, a scroll of any box holding the anchor (heard at the document and at each shadow root around it), the window resizing, and the visual viewport resizing or scrolling. Where the preview stands now is only its first candidate, at the same offsets from the box it stands by, on the same physical edge; the redraw bypass that skipped the hit test and the comparison by source element alone are gone. - A standing preview whose words grow over a neighbour stays where it stands and lets the pointer through to it (`data-lf-covers`), so a press on the neighbour reaches it. Before, the kept corner skipped the hit test and took the pointer, so the press only put the preview away. Moving it off the neighbour instead moved its words under the user's aim, which the shift watch reports. - A declared point that moves inside its element takes the preview with it, since the kept corner is held from the box, not the element: x=320 to x=700 now moves it to 700. - A scroll that carries the anchor to where its side no longer holds the preview puts it on a side that does: an inner box scrolled 200 px left it at y=-93 with room below; it now stands below. - The room is the visual viewport (geometry.js, `shownWindow`), and the preview is no wider than it (`--lf-preview-span`): at a 2x pinch the preview took a 1440 px layout viewport and ran 100 px past the 720 px shown; it now stands inside them. - A centred preview stands where the window puts it across, not by the element, so an element travelling under it, as the folded leaf does, leaves it still across. - The grid's limit is recorded beside its cost bound: a target smaller than its 23 px step can escape it; Leaf's own meet WCAG's 24 px, and no sampling proves an author's absent. A preview longer than its room is fitted by the lines the browser wraps: the block the room ends in keeps the lines that fit with a line clamp's ellipsis (`data-lf-clamp`), where before a single long name stayed whole, cut through by the face with no ellipsis. A list still leaves out whole items behind its count. `show()` reads first, and only a new reading replaces the standing preview: an aim at something that says nothing there, as empty space inside a chart, or a pointed-at element that says it changed and now says nothing, leaves the preview standing, as plain text does. Before, a focused chart's preview went as the pointer crossed empty space in another chart, or as a chart under a resting pointer took its ring off. `previewChanged` follows the declaration's owner: a widget that declares for a control in it that holds focus now redraws the preview on a new aim, and brings it back after Escape, where it kept the old words and then showed nothing. A move into a surface previews unless the surface opened since the user's last input (layer-stack.js, `openedThisInput`), recorded as a native layer opens and as the thread card says it opened (`surfaceOpened`). Before, entering any dialog from outside it counted as its opening, so a move into one already open showed nothing. Tests: test_previews holds each case in both engines where Playwright can (the pinch in Chromium alone), each written to fail on aa0023e first. The folded leaf's peek test lets the leaf finish its travel before Tab: its focus preview stood by the leaf on its way, which the shift watch reports, 2 runs in 3 on aa0023e too.
…latform's long press - A standing preview whose words grow keeps its corner and is held to the room down from it that covers no other target and not what it is about, its words fitted to that room with an ellipsis as any preview held to a room is. It moves afresh only on a new target or aim, or when the corner can't hold its first line. Before, it kept its corner over a neighbour and let the pointer through to it: the neighbour's label was hidden, and a pointer crossing onto the preview put it away. The room comes from hit tests out from the corner row by row (`clearRoom`), which replace the yes-or-no `covers`. A fresh decision still takes the first place that holds the preview whole and clear, then the first whole one, standing over what it covers and letting the pointer through (`data-lf-covers`, now that case's alone), then the one with the most room; a finger's or focus's preview takes no pointer anyway. - A declared box's geometry is taken from each reading, so a widget that changes one box in place, `at` from left 320 to 700, moves the preview to 700; before, its offsets were cached by the box's identity and it stayed at 320. - A preview is fitted to its room alone, measured from the face's top: a title clamped to six lines in a 180 px window shows whole once the window grows to 800 px or the preview shows again; before, the room was read from the already clamped face, so the clamp never lifted. - Every surface that opens through `openLayer` (focus.js) records its opening there, beside every native layer, which layer-stack.js records as it opens, and `openedThisInput` moved with the record: a widget that opens its dialog through `openLayer` and moves focus into it shows no preview as it opens, as on aa0023e. The thread card and the floating panel's views open through it, and the card's own report is gone. - One scheduler decides the standing preview again (`decide`), reading it again for a presentation or a resize, of the window or of what it stands by, and placing it alone for a scroll or the visible viewport: one window resize now decides once, where it decided twice, through `refresh` and the visual viewport's resize. - A finger's hold reads at the platform's own long press, its `contextmenu`, so a press the platform takes for a tap, as a longer touch-and-hold setting makes a slow one, presses. A WebKit touch engine sends none (WebKit bug 213953) and alone exposes `GestureEvent`, so there the hold reads after 500 ms, UIKit's default; the gap is in notes/browser-support.md with the WebKit source read. Hold tests send the `contextmenu` the engine would (`long_press`, render_harness.py), which Chromium's injected touch never does. A 180 px wheel scroll of an inner box flips a preview standing above its target to below exactly at the step its above side stops holding it, in both engines (aim at 145 px, the preview's top above would stand at 2 px, inside the 8 px edge). Tests: test_previews holds each case, written to fail on 433af26 first, in both engines but the hold's, which Playwright can hold in Chromium alone. The margin-entry, reaction and diff-row hold tests send the long press.
… room holds Each side's room is now the room it holds clear of every other control and of what the preview is about, and for a finger, whose hand hides what lies below the touch, below holds none. A preview takes the first side whose room holds it whole; else the side whose room holds the most whole lines, held there with an ellipsis; and only where no side's room holds a line does it stand over what it covers, on the side the window gives the most room, and let the pointer through (`data-lf-covers`, that case alone). Where no side holds a line at all, it stands over its target itself, and where even that holds none, nothing shows. Before: - in a box fenced by controls, a long preview stood whole over the row below with the pointer passing through it, its label hidden; it now stands on the side that holds two lines clear, fitted to them, and takes the pointer; - a long title clamped in a short window was also marked covering; it no longer is; - a 350x140 target in a 390x180 window drew an 8 px face with no readable line, which still took Escape; it now stands over the target with whole lines; - a held diff row stands above, over its toolbar, rather than below under the finger. A room and the line it is asked to hold come from one reading of layout, and every length is compared at the precision layout keeps (`faceLines`): the line is read off the face's own boxes, where `firstLine()` added the computed line height to the paddings. In Chromium a one-line room of 21.796875 px failed a first line of 21.8, so a preview whose words grew moved onto its neighbours; it now keeps its corner, clamped. The fit counts lines the same way, a list's count beneath them. A redraw tests only the rows and columns its words grew into, where the room it stood in was found clear before, and keeps a control it met: 41 hit tests a redraw where there were 81, 0.5 ms against 1.2 ms at 32 asks and 3.1 against 4.9 at 512 (Chromium, each line of growth wrapping twice). A scroll or a resize forgets what was found clear, so a wheel step still tests the whole place: 13 hit tests, 0.2 and 0.9 ms. A resize decides once for a target that follows the window's width too: the observer of what the preview stands by compares the size the decision read, and the scheduler holds its request while the decision runs, so what the decision sets going asks for none. A 50vw target decided twice per resize. A control's face names it only where its words hold a letter: a count beside a mark, as the folded On me's "1", names nothing, so it previews its name to the keyboard and a held finger, whose release then presses nothing, where it showed none and the release opened On me. notes/browser-support.md: `GestureEvent` is in desktop Safari too, where no touch starts a hold. Tests: test_previews holds each case, each failing on 6cfb9b9 first; the list preview's short window is 400 px, since at 260 px the floating panel leaves every side room for its name and count alone, which the rule now shows rather than covering the panel.
…oom afresh - The side test now leaves reachable what the user can work, the boundary every gesture owner shares (control-selectors.js, `WORKS`): fields, links, buttons, editable and focusable boxes and the ARIA widget roles, as well as whatever previews, which a pointer reads. It asked only `candidate()`, whose targets are what shows a preview, which leaves a field out: on a roomy page a preview of a button stood over the field under it and took the pointer, so a click there put the preview away and the field kept no focus, where main's labels focused it. It now stands clear and the click focuses the field. - No clearance is kept from one decision to the next: every decision tests the room its places hold. A redraw reused what the last one found clear while the target's box and the preview's width stood still, so a control that arrived under a standing preview, as `previewChanged` redrew it, stayed covered and lost its press; it is now found and the preview stands clear of it. The reuse saved 0.45 ms a growing redraw at 32 asks and 1.2 ms at 512 (41 hit tests against 81, Chromium), and no signal says the page around a preview has stood still, so it goes, with the decision's `moved`. The list preview's test window is 260 px again: with a list's count counted beneath its lines it shows seven items and its count there, on 75c9294 as now.
…on the user works - A focus or finger preview that no place can hold yet, as a target out of view as focus reaches it, waits until its target comes into view, which the platform says whatever brings it there (an IntersectionObserver), and the scheduler decides again then. It was discarded, and nothing showed once the scroll settled: in the feature gallery, Tab from the sample's create button onto Accept now shows "Accept" when it lands, as main's label does. The wait ends as focus moves on, at the next press or as the tab goes. A pointer preview needs none, since a pointer aims only at what shows. - What a preview must leave reachable is everything whose access the user must keep, a predicate of its own (`keepsAccess`): what the page works (`WORKS`), anything focusable, a stop Leaf lends overflowing code or a tab panel included, anything that scrolls, anything embedding a document, and whatever previews. It borrowed `WORKS`, whose exclusions, the lent reach stop and tab panels, serve the gestures Leaf routes: a preview of a button stood over the scrolling code, the tab panel or the frame under it and took the click meant for it, where main focuses it. A hit stops at what holds the preview's target, which stands under it wherever it stands. - A centred preview stands as near the window's middle as it can while it still stands across its target. Resolve's preview in review-a-plan's first card stood centred 576 px from Resolve at 1440 wide; it now stands beside Resolve in the card's head, over what it covers there, as it already did at 1100.
# Conflicts: # browser/runtime/floating-panel.js # tests/browser/test_render_floating_panel.py
The marker's preview is about its target (`about`), so it stands clear of the target and the trace around it, and the old test's premise, a label crossing the trace with the trace painting under it, cannot arise: it failed on this branch since the margin entries took their passage as their subject. It now holds that the preview stands clear of the traced target's ring. It passes on main's labels' behaviour no longer; the paint-order question goes with the crossing.
…ow are module-input.md listed a finger lifting among the ways a preview ends, which held before a hold's release pressed nothing; a held preview now ends at the next touch. preview.js's header placed the face in controls.css, where its rules were before they moved into the chrome sheet; they are in chrome.css.
leaf-agent
left a comment
There was a problem hiding this comment.
Range targets have no caller outside the tests. Nothing in the runtime calls pointRange. It is exported only through check-api.js, whose comment says "as a passage mark's will be", and only test_previews.py calls it. The written contract says this owner already exists:
- the
preview.jsheader: "A range with no element of its own, as a passage mark is, is its owner's to hit test, so the owner says where the pointer rests (pointRange)" - the new
browser/AGENTS.mdbullet: "a range's owner says the pointer rests on it", plus the ownership-table row namingpointRange - the PR body, which becomes
main's commit message: "A range with no element of its own, such as a passage mark, is reported by its owner throughpointRange"
AGENTS.md ("Stage") says written contracts describe the current code. The Behaviour changes list also names no passage-mark preview, so the claim is the only sign this path is meant to ship.
The Range path also runs through the core of the module: readFrom's range branch, the line pick in anchorOf, sameRange, wait's range handling, GAP.line, the instanceof Range branches in stand and point, and two tests. Later changes to placement have to keep all of it working for a target nobody points at. That makes it the "room reserved for a state that may not come" that /developing-leaf ("Weigh what a change adds") asks a change to justify. There are two cheaper ways to settle it:
- wire the passage marks to
pointRangein this PR, so the claim becomes true and the passage marks join the behaviour changes; - or drop Range targets,
pointRangeand their tests, and remove the passage-mark sentences from the prose. A passage mark can bring the path back with its first caller.
A range with no element of its own previewed through its owner's `pointRange`, and nothing outside the tests called it: the passage marks that would report through it are thread previews' (`anchor-paint.js`), which builds on this API. Range targets come back in that branch with their caller and are reviewed there, so the written contract describes the code it ships with (AGENTS.md, "Stage"). Removed: `pointRange` and its `check-api.js` export; the Range branches of `readFrom`, `anchorOf`'s line pick, `wait`, `stand`'s gap and its beside places, `ended`, and the pointer's handling of a range under it; `sameRange`; `GAP.line`; and the read and point a range's owner passed through `point`, `show` and a standing or waiting record. Every caller of those for an element passed none, so no element target's preview changes. The preview.js header, browser/AGENTS.md's "One owner shows every preview" bullet and its question index row drop their range sentences. Tests: the three range tests go (a range's line, its owner's latest words, and a link inside a range's passage), and the write test keeps its scroller half, whose preview is now the session's first.
leaf-agent
left a comment
There was a problem hiding this comment.
The description still says "A range with no element of its own, such as a passage mark, is reported by its owner through pointRange." That sentence ends the Contract section, and pointRange no longer exists at this head. The description becomes main's commit message, so drop the sentence before merging.
At 1400 px the last input mark's preview stood beside the mark, over three other marks of its lane: the lane's bars are 8 px tall and its send marks 2 px wide, and the owner's hit tests, 23 px apart, landed on none of them (rows at y 259 and 276 around bars at 260-268), so the room beside read as clear. Each mark now declares its lane as what its preview is about (timeline.js, `said`), so the preview keeps clear of the whole lane and stands below the mark from its end edge, cut to the room above the timeline's canvas. preview.js said Leaf's own targets meet WCAG's 24 px, so the grid's limit touched only an author's; the trace's marks are thinner, and the header and `clearRoom` now say so and how those marks keep clear. Tests: the timeline test asserted only above or below the mark, which the rule's beside place broke at 1400 px, and nothing about covering marks. It now runs at 1400 px in Firefox too, and holds that the preview stays inside the window, never covers its own mark, covers no other mark at a desktop width, and covers one only where it says so (`data-lf-covers`) and lets the pointer through, as at the end of a phone's input lane, where no side holds a line clear. Without the lane both 1400 px cases fail.
…ge makes them Five of the test job's failures on 2e14833 are tests this branch rewrote; the sixth, `test_trace_comments_restore_an_exact_image_and_duplicate_named_element`, fails the same way on main 62cb54f and is left. - Send's preview: the test wrote Shift as ⇧, a Mac's spelling. The chips come from the register's formatter (keyboard/bindings.js, `spell`), which writes Shift+ off a Mac, as on CI's Linux; the test now reads its expected keys from `spell`, as main's test allowed either spelling. - A standing preview carried by a scroll: the test scrolled the box by script, so the preview's change of side came with no input, which the shift watch reported on CI where the scroll and the decision shared a frame. The user scrolls with the wheel, so the test does, over an empty part of the box. - The trace journeys' `said_by_marks` read every declaration and broke on one that adds nothing now (null), as a caption with no words does; it skips those and writes a mark's words only where they changed, as the write watch asks. - The zoom journey looked for each moment at a line's start, but a shared flag lists its moments after their labels; it finds each moment anywhere in the flags' words, and finds the third moment's own flag by its number. - The numbered-moments journey read the flag's words as shown. Its moments lane is what its preview is about (2e14833), so the preview takes the room above the lane, which holds its first line, "2 moments", and cuts the rest, as the placement rule holds any preview to the side whose room holds the most lines. The test reads the flag's lines as its face holds them, and reads its contrast from the face, which has drawn the preview's ground since the face alone fades.
… until the next touch Main's preview owner (#5614) reads a pointer or key reaching something new inside an element as a new aim, `previewChanged(element, {aim: true})`, which shows its preview whatever put the last one away. The chart now says so wherever the pointer or an arrow reaches a new point, so after Escape the next point the pointer reaches shows its preview. A pointer still on the point Escape put away reads nothing until it reaches another. A key's step still declares its place in its series (`beginWalk`), which main's owner no longer reads as an aim. Main's hold rule reads a finger at the platform's long press, and the release presses nothing and leaves the preview standing until the next touch. The chart keeps a held finger's point and ring after it lifts, while the chart wears `data-lf-held`, until the owner ends the preview. One change to the owner. It placed a preview afresh at every aim, so each of a chart's points chose its side again. On a chart at the window's top, the preview flipped between above and below its points as the pointer swept them: four flips in one sweep of 35 points. An aim inside the element the preview already stands for now keeps where it stands, its side and offsets carried to the new point's box, and the preview moves only when that room no longer holds a line. The same sweep now changes side once, at the first point too high for above, and in the window's middle it stays above every point. No sweep puts it over a point. `show` and `stand` lose the flag that carried the aim. Tests: - The pointer test now checks that Escape keeps the pointer's point quiet and that the next point shows its preview again. - The hold test follows main's rule: the reading comes at `long_press`, and the lift leaves the preview and ring until a touch elsewhere puts them away. - A new test sweeps a chart at the window's top and checks the preview keeps its side. Each new assertion fails on the code before this change. The side test fails on main's owner in both engines, reading above, below, above. Measured against 0666c74, the branch before main's owner: - A pointer move on the 5,000-point chart is still at most 1 ms at the 90th percentile. Chromium's p90 went from 0.7 to 0.5 and 0.8 ms; Firefox's went from 2–3 ms to 0–1 ms, read on Firefox's 1 ms clock. - Narrowing a page of 100 charts to 680 px took 192–200 ms against 290–296 ms in Chromium, and 151–176 ms against 182–212 ms in Firefox. The earlier version always ran first, so part of that gap may be order.
… the page changes (#5618) Pointing at a thread's passage, where nothing else there takes the pointer, or at its margin entry or its row in Threads now previews the thread: its name, who wrote its last message and when, that message's opening line, and where the thread stands ("Your turn · 1 unread · 2 messages"). Keyboard focus on the entry or the row reads the same preview, and a finger reads it by holding. An age such as "82d ago" previews its clock time in the reader's zone ("Sat 15 Aug 2026, 14:02 PT"), and packages get the same preview from `agePreview` in the widget API. Underneath, a thread's mark stays on its words as the page's scripts and revisions move them, at a cost that follows the change rather than the page's size, and a quote or a page search matches words where two inline elements meet, whether the page draws them as one word or two. ### Where each passage stands `browser/runtime/anchor-placement.js` is the one record of where each thread's passage stands, and the draft's. Every read settles first (`settle`, reached through `placedAt`, `pendingAt`, the hit test and a presentation) and takes the changes the page's watcher still holds, so no reader sees placement older than the page. The file's header lists what a quote's resolution depends on and how a change to each reaches `settle`. The page's index of quotes (`passages.js`, `trackQuotes` and `quotesChanged`) keeps every copy of each quote the threads name, placed or not, and the words a resolution read beside a copy to tell copies apart. After a change it compares the old reading with the new (`changedSpan`) and searches again only the span they differ in (`carry`), so placement places again only the threads whose quotes changed, whose section ids moved, or whose text nodes a change rewrote. Copies are found by one Aho–Corasick automaton over every quote's spelling (`automatonOf`, `scan`, `findEach`), in one pass over the page however many quotes there are. No maintained dependency searches a window of the page's letters, so the automaton is written here. `annotation-overlay/anchor-paint.js` paints from placement (`hearPlaced`) and finds the mark under the pointer with one caret lookup and an index of the stretches each text node's marks cut it into (`markHit`). `highlightsFromPoint` would read every range on the page on each move; `notes/browser-support.md` ("Highlight hit testing") records its cost and how to recheck it. `tests/runtime/anchor-placement.test.mjs` compares placement with a fresh resolution after seeded runs of the changes a page's scripts make. ### One reading walk with link previews Link previews (#5616) and this branch read the page with one walk in `passages.js`: link's outline recording rides the same walk that carries the element each run of words is read in. One watcher (`hear`) forgets the reading of each document a change touches and tells the page's hearers, the quote index and placement, what changed. One `phrasing` predicate, built from the kernel registry's `$passages.phrasing`, answers both the walk's `enter` and link's `runsIntoLine`, and `tests/runtime/passage-boundaries.test.mjs` holds the two to the same answers. ### The file and the browser read alike The file's reading (`src/leaf/passages.py`, `src/leaf/anchor_capture.py`) confirms the quotes an agent comments on and places threads across a revision; the browser's (`passages.js`) captures, marks and searches them. `tests/quote_cases.json` holds both to the same answer on 34 cases (fences, overlaps, context, edges, gaps, blocks, staged shadow trees, said values, slots, whitespace), run by `test_a_quote_resolves_where_the_browser_resolves_it` in Python and `tests/runtime/quote-cases.test.mjs` in the browser runtime. Both split a quote into words, and find the gaps between them, by the registry's `$passages.collapse` alone, so a character only Python calls whitespace, such as U+001E, is a letter in both. A widget's verbatim reading (`x-verbatim`) is written from the page's reading, every space where that reading put one. ### Where two inline elements meet A quote and a page search now match across the place two inline elements meet with nothing between them, with or without a space, in both readings, since only the page's CSS says whether `<strong>Status</strong><span>Ready</span>` shows one word or two. The end of an element outside `$passages.phrasing` and a `<br>` stay real gaps that a quote can't run across. A survey of 657 retained pages found 2,918 pairs of words drawn apart that the reading joined, on 183 pages, more than half of them in Leaf's own widgets (lf-option's chips and title, lf-trace, lf-timeline). A search with a space between found 228 of those pairs before this change and finds all of them now. `$passages.collapse`, `blocks` and `phrasing` decide the words a capture logs, and `$passages`' description now says a change to any of them bumps `$events.protocol`; none of the three lists changes here, so the protocol stays at 42. The 267 quote anchors in the logs of 113 retained pages attach to the same words as on main, in the file's reading (checked at this head) and in Chromium's (checked when the edge rule landed). The words a reading shows, as distinct from the words it matches (a captured quote, an accessible name, an excerpt), show such a meeting as main does: a space where two elements outside any text block meet, as a chip meets its title, and nothing inside a text block, so `set<em>up</em>` reads "setup" (`shownApart` in `passages.js`, the soft space in `passages.py`'s `_write`). Shipped examples, docs and widget templates now put whitespace between a chip, label or code and the words after it. ### Range targets on main's preview owner The preview owner (#5614) landed with its range targets moved out to this branch beside their one caller. They come back onto main's `preview.js` as the owner had them: `pointRange`, `holdRange`, `sameRange`, the Range branches of `readFrom`, and the line a range's preview stands by. `anchor-paint.js` is the range owner: it tells `pointRange` which passage the pointer rests on, only on the user's own pointer input and only when the threads under the pointer change. It tells the piece the preview stands by, the one the pointer came onto. The owner keeps that range as a layer of its own (`ranged`) beside the element under the pointer that previews itself (`over`), and reads one or the other by the rule in the next section, so the pointer leaving a link for the passage's words is on the passage again, though nothing tells the owner anew. A finger's hold on a passage follows main's hold: it reads at the platform's long press, and its release presses nothing. ### Where a thread's words preview the thread A thread's words preview the thread only where nothing else at that point takes the pointer. `aimableAt` (`widget-elements.js`) answers, for any point on the page, marked words or not, what else the user could aim at there: the nearest element around it as the page renders it, through the slot that draws it, that is a control, native or ARIA (`CONTROLS`, main's `WORKS` less a plain tab stop), carries a title the browser shows, declares `lfPreview`, or is a registered widget that draws its content itself (`x-content` `data` or `empty`). A plain tab stop, a scrolling box and what a widget holds of the author's markup, outside any control in it, take nothing: a pane's words, an option's words beside its mark, a suggestion's old and new words, a playground's preview. A widget's verbs (`x-state`) say what it records, not that a press on its content acts. The pointer and a held finger read a thread's range only where `aimableAt` answers nothing (`readingAt` in `preview.js`), and otherwise the element there that previews itself, or nothing. Focus rests on an element and reads it, as on main, never a range. So a passage inside a link, or equal to its text, previews the link; in a titled button only the browser's title shows; a gloss's words preview its explanation; and words in a card that declares a preview show the card's. Words a component slots into its titled button show only the browser's title. A thread's words in `lf-code`, `lf-diff` or a draft preview nothing to a pointer or a finger, and the thread is reached by its margin entry, which previews it, by `t` and by its row in Threads. Words in prose, a plain tab stop, a pane, a suggestion, a playground's preview or an option beside its mark preview their thread. `module-input.md` ("Previews") states the rule for package authors, and the chart branch's target can ask `aimableAt` once this lands. Presses are as on main. A press on a thread's words opens the thread unless main's `WORKS` boundary keeps it for a control or a region, so a tap on a thread's words in a plain tab stop or an informational card opens nothing, in Firefox as in Chromium, and a press that main gives both a widget's action and the thread, as a gloss pinning its explanation, still does both (see "Left for later"). ### Fixes from review - The file's reading now gives every node that holds words, each element and each said value's span, a key from a counter it keeps as it reads. It had keyed an element by `id(frame)` after the element closed, which Python reuses, and an element's first `before` and first `after` said values by one key. So `<small>reversible</small><strong><em>Heat</em></strong>` could read `reversibleHeat`, and a comment the browser captured on a formatted label was Not found after a revision instead of moving to its section. - A passage's preview went about 200 ms after the pointer moved onto it, because the range owner reported no range there. `pointRange(null)` now leaves a preview the pointer is on standing, as the owner does for an element's preview. - The panel's guard against a run of clicks (`floating-panel.js`, `runOfClicks`) now refuses a click only where it lands on another control than the run's last press and the panel has drawn since that press began (`draws`, counted in `paintPanel`). It exists for a control that comes under a still pointer because the last press changed the panel, and a double or triple click on ‹ still goes back once. Main's guard refused every click in a run that landed on another control than the last click the panel received. A finger's hold that reads a preview presses nothing, but Chromium counts it into the run, so the tap after it was refused: on the row the finger held, and on Close 6 px beside a held Search, which main refuses too. The hold draws nothing in the panel, so that tap now goes through. - Back from a thread hands focus back to the thread's row in Threads as a `return`, as the menu's way back already does, so the row shows no preview until the user steps onto it. - A press in a thread view's head holds the view's height once the press's script ends, still before the frame. When the keyboard pressed Back, the hold wrote the height and Back's transition took it away in the same script, a write Firefox's write watch reports as changing nothing; main has the same write. - A widget's verbatim reading had re-derived its spaces from the change of block, which a phrasing element no longer makes, so `<lf-shell><div><b>Status</b>Ready</div></lf-shell>` read `StatusReady` where the page reads `Status Ready`, and `page check --render` flagged a correct `x-verbatim` widget. It now takes the words the page's reading wrote, spaces included. - The file split a quote into words on Python's whitespace, so `<p>x A\x1eB y</p>` confirmed the quote "A B" where the browser finds no copy. Both readings now split on `$passages.collapse`. - A mark that came to stand under a pointer the user had stopped, on a page that marked nothing before, previewed: the frame kept the user's aim for later when nothing was marked. It now spends the aim in the frame it was made for. - A passage's preview didn't come back after the pointer crossed a link inside the passage and returned to its words, since the link took the owner's one target and nothing gave the range back. The range is now a layer of its own (see "Range targets on main's preview owner"). ### Measured Main-thread time in Chromium unless an engine is named, on a shared machine, against main (1d5249c). The first two were measured at 2c32d1f, whose later changes reach neither; the last two at 2c32d1f or 6d9194e and again at 73c5396, given as a range where the runs differ: - A presentation of a page whose one paragraph holds 32, 512 and 1,600 marked passages: 4.1, 98 and 975 ms on main; 4.4, 12 and 36 ms here. - A script edit that moves every passage in that paragraph, a leading space written and taken away: 0.25, 0.9 and 3.1 ms on main, which leaves the marks where the DOM moved their ranges until a presentation places them again. Here the edit places them again at once and takes 5, 55 and 294 ms; when last profiled, about 255 ms of the 1,600 case was the margin laying out its rows (`layoutMarginRows`). - Finding the copies of 1,600 quotes of the same 60 letters with their spaces in different places, on a page of 640 x's: 21 ms in Chromium and 20 to 22 ms in Firefox; of 640 letters each, a million characters in all, about 10 ms in both. - A pointer move across a mark on a page of 32 and of 512 paragraphs, a thread on each: 0.60 to 0.69 and 1.11 to 1.26 ms here, where the move previews the thread; 0.47 and 1.55 to 1.97 ms on main, where it previews nothing. ### Left for later - One action for each press on a thread's words. On main, and here, a press on a thread's words in a widget that takes it does two things: a gloss pins its explanation, a draft opens its editor, an option is picked and a timeline event takes the playhead, and each also opens the thread. A press in a plain tab stop or a card that only previews is swallowed. [`press-ownership`](https://github.com/max-sixty/leaf/tree/press-ownership) (b2ac1ce) makes one press decision that every route asks (`pressedControl`): widgets declare the part that takes their own press (`x-press`, validated with the registry's other conditions) and say when they can act (`lfTakesPress`), and a held finger, the hand over a mark and the trace's image tools follow the same decision. Codex's findings over its four review rounds are its acceptance set. Its last review left five: the trace's canvas and the playground's preview are refused as the widgets' own content, so a Firefox tap no longer stops playback, a click pauses and also opens the thread, and the Status strip no longer selects; availability is read again after the widget acts, so one click gets two decisions; a `role="button"` host bypasses `lfTakesPress`; a `region` match escapes the nested-boundary check; and the selector check refuses valid selectors such as `:state(ready)`. Two cases this branch's last review found belong there too, both on main: an option's words preview its thread while a click there also picks or clears the option, and a click on a thread's words slotted into a button presses the button and opens the thread, because the page's click looks for a control without following slots (`surface.js`, `closestAcross`) where `aimableAt` now follows them. - A closed gloss's tip is read inside its sentence. Both readings put an `lf-gloss`'s hidden explanation between the words around it, so a quote of the visible sentence "static analysis of the orchestration file" on `examples/pr-walkthrough.html` resolves to nothing. This predates the branch. A fix needs an aside passage, a range a quote lies wholly inside or skips, recorded in both readings and declared in the registry. - Incremental page reading. While a script rewrites words every frame, each hover frame builds the page's reading again: 6.5 ms of a pointer move at 1,600 sections, measured at 8fa11f8. The watcher could re-walk only the subtrees its records name. - Light slots in `renderedChildren`. Margin layout's `renderedChildren` (`shadow.js`) and focus.js's `renderedElements` (Tab order) read every slot through its assigned nodes, so they miss the children of a slot outside a shadow tree, as the reading's walk did before this branch. One helper for what a slot draws would serve all three. - `pageRange` across a shadow root. A drag from page text into a declared shadow stage falls back to the light-DOM range (`native-selection.js`), which in Chromium ends before it starts and in Firefox covers only the words inside the stage, so a comment made from that drag doesn't quote the words selected. Main has the same gap. - A double or triple click on Back can shrink the panel out from under the pointer, so the later clicks land on the page, select its words and close Threads; main does the same. The guard hears only presses inside the panel. Covering this means moving its listeners to the document's capture phase, where it would refuse a press outside the panel whose run's last press was on a panel control the panel drew after: every press on the page would pass through it, and a deliberate double-click on page words just after a press on Back would be refused. - A live update that redraws the panel during a hold, such as a comment admitted from another tab, still gets the next tap on another control refused, since the guard counts the panel's draws rather than asking whether the press moved the control under the pointer; main does the same. This and the Back case above both want one owner of a run of clicks across the surfaces it changes, the panel and the page. > _This was written by Claude Code on behalf of max-sixty_
Comments, docstrings and one note that point at names the code no longer has. Each now names the rule or function it means. Nothing that runs changes. - **Renamed `browser/AGENTS.md` sections.** `floating-panel.js` cited "News never moves what the reader is reading", and `composing/text-field.js` cited "Editing in place" and "Stability". None of these is a heading or rule any more. They now name "News moves what the reader reads only in the thread they are in", "Editing something keeps it where it stood and as it read" and "The page holds still under the user's aim". - **`keyboard/layer-stack.js`, `nativeModes`.** The comment counted hint popovers among the modes, but since #5614 `pushNativeLayer` returns `null` for `popover="hint"`, so no hint popover ever joins the stack. The module header already says so. - **Functions that were removed or never existed:** - `floating-panel.css` cited `rowNotice`, which #5613 deleted. It now cites `rowNoticeTemplate`. - `thread/messages.js` cited `preview.js`'s `fitList`, which has never existed. The fitter is `fit`. - **`packages/diff/widget-shadow.css`.** Two z-index comments gave the full-name path box as their reason, and #5614 removed that box. The values stay. The comments now give the stacking they keep: the line numbers sit at 2, the pinned name at 3 and the file's actions at 4. - **`notes/fork-replies.md`.** It said a `forked-replies` branch builds the design, and that the fork posts "the reply". `forks.py` has been on main since #4892, and since #5552 the fork posts only the working line. The rest of the note, the research and the unbuilt "fork that takes the work", stays. - **Smaller fixes:** - The `plans.py` docstrings now name the `items` parameter. - The `structure.py` allocation comment now points at `AUTHORED_ALLOCATIONS`, which also holds `data-height` and the page-wide allocations. - A runtime test now names `tokens.css`, where the card widths live. - A test comment now names `test_admission.py`, where #3089 moved the named-dependency test. - **`packages/default/styles/sample.css`.** A trailing comment governing no rule repeated the exhibit rule that `options.css` states and applies, so it is deleted. Verification: pre-commit (ruff, prettier, eslint, ty, knip, typos) passes on the changed files, and `tests/runtime/comment-placement.test.mjs` passes. No test is added, since nothing that runs changes. Co-authored-by: leaf-agent <[email protected]>
…operties (#5626) `test_trace_dense_moments_keep_the_axis_usable_and_page_scoped` was still checking the trace widget's old markup in two places. With both reads fixed, the journey passes again (it fails on main). - **Mark position.** The test located each axis mark by reading `--t`. Since #5368 the marks use `--lf-axis-at`, and nothing sets `--t` any more. `Number('')` is `0`, so the test expected every mark at the axis start, and the offset check `max(reading["offsets"]) <= 1` failed by 785–1125 px. This is the failure the scheduled run [42205827418](https://github.com/max-sixty/leaf/actions/runs/42205827418) hit, tracked under #4225. The test now reads `--lf-axis-at`. The widget's placement didn't change. - **Moment flag words.** The test read each flag's words from `data-lf-tip`, which nothing has written since #5614 moved a mark's words into its `lfPreview`. Joining that list of `None` would raise `TypeError`. The test now calls `said_by_marks`, the helper #5614 added and the other trace tests already use, then reads `data-test-tip`. It checks that the shared flags list moments 2–21 in order in the preview's `<name> · Moment N · <time>` lines. `tests/browser/test_render_playwright_trace.py` also read `dataset.lfTip`, but only in a failure message, where it would print `undefined`. That message now names the mark by its text or class. Verification: on head 9deaed2 (tip fix only), the PR's `test` job failed at the offset assertion. Run locally on this head, the journey passes. Refs #4225 --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
main's folded-leaf preview (#5614) reads commandSteps in floating-panel.js, whose import this branch had dropped once its presses read their keys from the dispatcher; the import is back. The panel tests' imports take both sides.
Three things #5614 (the preview owner) changed for users broke tests in main's push suite. Each is a gap between the rule #5614 wrote and the code that carries it, so the code changes and the tests that caught it stand as they were. - A thread card previewed its own name. preview.js counted every element wearing `data-lf-offer` as a control, but an empty `data-lf-offer` marks Leaf chrome that presses nothing (widget-elements.js, `PRESSABLE`). A thread card's accessible name is "Thread, " and its first words, which differ from its face, so a pointer resting anywhere in a card showed "Thread, Keep this review note…" over the words it repeats, and a `t` walk landing on a card already on the page showed the same preview, which took the Escape that lets go of the thread. `test_the_pr_walkthrough_exercises_an_inline_diff_thread` caught the walk. A control is now what `PRESSABLE` names, with buttons, links and summaries, so a card previews nothing of its own and a message keeps its age preview. `test_an_age_previews_its_clock_time_in_the_reader_s_zone` passed only through this: a pointer moved onto the words of the message the keyboard was on showed the card's name in place of the keyboard's clock time. A pointer there now reads nothing, so the keyboard's reading stands, which the test now asserts by its route. - A reaction's disclosure took one Escape more to fold. Enter on a reaction's glyph reveals its Undo and puts the user there with a `move`, which preview.js reads as the user's own move, so the Undo showed its preview and the first Escape only put that away. keyboard/AGENTS.md ("Escape") says focus a surface places as it opens costs no Escape. The disclosure now says it opened (`layerOpened`) before placing focus, as a layer does. `test_a_press_away_takes_back_a_reaction_s_offered_remove` and `test_a_token_press_marks_the_passage_and_its_revealed_remove_takes_it_back` caught it. - The command reference stopped running Resolve and Copy message. #5614 made `r` and Mod+C name the thread's Resolve and the message's Copy as their control, with no `run` of their own, so the key presses the control (bindings.js, `commandRun`). The reference decided which rows it can run by a second reading of a row that left that case out, so both rows became explanations. It now runs what the row's key runs, the control's press included. On the PR walkthrough exactly those two rows change. `test_the_reference_runs_available_commands_and_explains_the_rest` and `test_the_reference_keeps_local_search_state_on_one_lit_surface` caught it. held-news.js still said the notice's title carries each fact; its preview does now. > _This was written by Claude Code on behalf of max-sixty_
… away first These tests have failed on main since #5614 (the preview owner), each asserting behaviour #5614 replaced on purpose. Run singly, each passes at 62cb54f, the parent of #5614, and fails at 84d9186. The behaviour each protects stays asserted. - Leaf's own controls write no `title` on Leaf; their words are their preview. A held-news notice's whole label ("1 new reply · 1 message edited"), an All pages row's account, a diff row's cut path, an On me choice's words and the joined notice in Threads were read as a title, or as the accessible description a title gave. They are now read off the element's preview declaration (`expect_preview_words`) in test_thread_surfaces, test_summaries, test_render_read_state, test_agent_replies, test_render_application_boundary, test_status_and_news, test_render_controls, test_render_floating_panel, test_diffs and test_on_panel. A screen reader now hears a notice's label as its description while its preview stands on focus, not at rest. - Focus the user moves onto a control, by Tab, an arrow or a walk, shows its preview, and Escape's first step puts that away and does nothing else (keyboard/AGENTS.md, "Escape"). A script's `.focus()` stands in for such a move. Tests that expected one Escape to close the surface the control stands in now put the preview away first, with `put_preview_away`, a new helper in render_harness.py, and then assert the step they protect: test_live_samples, test_clusters, test_entries, test_render_reactions (three tests), test_rewrites, test_playgrounds and test_render_anchors. The sites #5614 and the key-scope commit wrote inline (test_command_routes, threads/test_navigation, test_key_scopes) use the helper too. test_playgrounds still fails, now on the step it protects: once the preview on the instruction's Copy is put away, the next Escape leaves the instruction popover open and only the one after closes it. That is a lost Escape for the user, not the test. Four journey tests, which run only nightly, read the same titles and descriptions: test_render_anchors, test_render_threads and test_website_server now pass; test_render_files passes the title step and fails earlier, where #5617 changed what an external file update does to the editor's gutter. A failure at line 743 of test_summaries.py, older than these PRs, hides the same notice description at line 769 in test_a_root_summary_keeps_thread_actions_outside_its_fold, which now reads the preview too. > _This was written by Claude Code on behalf of max-sixty_
The panel field's right side now offers the press that matters most at that moment, in the format *Comment…* `c` already uses: the word, then its key, dim and italic. Max picked the rule and its moments on a review page; #5613 built the first of them, *Undo* `z` after a Resolve, and this PR rolls out the rest. | Moment | The field's end shows | | --- | --- | | Right after a Resolve, with an open thread left | *Next thread* `t` (with none left, *Undo* `z` as before) | | After the user answers, with more On Me | *Next On Me* `m` | | A thread open in the panel | *Reply…* `c` | | Draw or Design mode | *Close* `esc`, in place of the seat's ✕ | | Reading an older version | *Comment…* `c`, with the older version's chip after the field | | Words selected on the page | the quote in the field's words, with *Comment…* `c` at its end | ## How it works - **One press shape.** A box's field end draws a `BoxPress {word, keys, run}` (`composing/text-field.js`). A notice's press (`notifications.js`, `offerPress`) lives as long as the notice: the user's next input withdraws it, unless that input is on the press itself. - **Presses run as commands.** Pressing one runs its command through `pressCommand` (`keyboard/dispatch.js`), the route touch controls take, so it acts wherever the caret is. The key shows only while `activeCommandLabel` says that key reaches the command now, and *Close* shows `esc` only while `escapeInvocation()` says Escape would end the stance. The target picker's letter take-back became its own row, `targeting.letter.back`, so Escape and *Close* never disagree there. - **Next thread** comes from `nextStep` in `thread/folding.js` when `anyOpenThread` finds one; otherwise the Resolve keeps offering *Undo*. - **Next On Me** comes from the server's reading, not a browser prediction: `application.js` offers it when an obligation's `answer.event.id` is the gesture's own id and On Me still holds something. Picks, settling reactions and card replies offer it. - **Holding still.** While the pointer is on the panel the shown press stays put (`pagePress` in `floating-panel.js`), and it repaints on `pointerleave` if the moment changed. The per-frame recheck in `composing/input.js` reads the press's key getters rather than recomputing the field's words, which walked the queues, so a keystroke's cost doesn't grow with the page. ## Decisions These were put to Max on the review page, and he kept them: - The older version's chip steps aside while a press stands, so news arriving doesn't move the press. In Draw or Design mode on an older version it stays hidden until the mode ends; the menu's Latest still works. - No *Next On Me* after a comment or reply sent from the panel's own field: the caret stays there for the next turn, and offering it would mean moving the caret out after every send. - *Close* `esc` ends every stance: Select mode and a region capture as well as Draw and Design. - After the panel's own Resolve, which already opens the next thread when the thread came from Threads, *Next thread* moves on to the one after it. ## Testing `dev/leaf_dev/states.py` gains a stills state for each new moment (`panel-resolved`, `ship-option-answered`, `panel-draw-mode`, `panel-selection`); the before/after stills were reviewed on the review page. Browser tests cover each press: the Resolve tests now expect *Next thread* `t`, and with no thread left *Undo* `z`; `navigation/test_on_panel.py` covers *Next On Me* after an answer; `test_render_semantic_selection.py` covers the picker's *Close* against Escape; `render_harness.field_press` reads the field's end. Two independent Codex reviews found five defects and one per-keystroke cost, all fixed on the branch. Locally: the runtime tests pass (896/896), the type check passes, and the focused browser tests pass except `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice`, which fails the same way on `main` (#5614's folded-leaf preview moves the row 330 px with no input). > _This was written by Claude Code on behalf of max-sixty_
…nd them (#5629) Five PRs landed on `main` without the full push suite: #5614 (the preview owner), #5615, #5616, #5618 and #5617. Main's push `ci` run at 4248d1f ([42246533122](https://github.com/max-sixty/leaf/actions/runs/42246533122)) fails about 50 tests that the run at its parent 62cb54f ([42203695127](https://github.com/max-sixty/leaf/actions/runs/42203695127)) passes, and they still fail at ef6c01e ([42320062138](https://github.com/max-sixty/leaf/actions/runs/42320062138)). Run singly here, every one of them but three fails at 84d9186 and passes at 62cb54f; the three are at the end. This branch fixes the code where the PRs did something worse for a user than their own rules say, and updates the tests that asserted behaviour the PRs replaced on purpose. ## Code: three gaps between #5614's rules and its code - **A thread card previewed its own name.** `preview.js` counted every element wearing `data-lf-offer` as a control, and Leaf writes an empty one on chrome that presses nothing. A pointer resting anywhere in a thread card showed "Thread, Keep this review note…" over the words it repeats, and a `t` walk landing on a card already on the page showed it too, which took the Escape that lets go of the thread. A control is now any native or ARIA press (`PRESSES`, `control-selectors.js`), ranges and selects included, or a custom control whose `data-lf-offer` names its press (`PRESSABLE`). Thread cards, messages, resolved groups, toolbars and status or layout chrome preview nothing of their own; an element's own `lfPreview` is read either way. `test_a_range_and_a_select_preview_their_names_and_a_thread_card_none` holds both halves in both engines. (The branch's first try at this used `PRESSABLE` alone, which also dropped the previews of Leaf's own ranges and selects, since they wear an empty `data-lf-offer` too.) - **A reaction's disclosure took an extra Escape.** Enter on a reaction's glyph puts the user on its revealed Undo with a `move`, which `preview.js` reads as the user's own move, so the Undo previewed and the first Escape only put that away. `keyboard/AGENTS.md` ("Escape") says focus a surface places as it opens costs no Escape. The disclosure now says it opened (`layerOpened`) before placing focus. - **The command reference stopped running Resolve and Copy message.** #5614 made `r` and Mod+C press the thread's Resolve and the message's Copy as their `control`, with no `run`. The reference's own reading of which rows it can run left that case out. It now runs what the row's key runs, the control's press included. On the PR walkthrough exactly those two rows change. ## Tests: behaviour the PRs replaced on purpose - **Titles became previews.** Leaf's controls write no `title` on Leaf. Tests that read a held-news notice's label as its accessible description, or a title on an All pages row, a diff row's path, an On me choice or the joined notice, now read the element's preview declaration (`expect_preview_words`). - **A focus preview is Escape's first step.** Tests that expected one Escape to close the surface a focused control stands in now put the preview away first, with a new `put_preview_away` helper, then assert the step they protect. The inline sites #5614 and the key-scope commit wrote use the helper too. - `test_key_scopes.py`'s two tests: the branch's first commit, as before. - `test_an_age_previews_its_clock_time_in_the_reader_s_zone` (#5618) passed only through the thread-card name preview above. It now asserts the keyboard's clock-time preview stays visible, on the focus route, with its words, while the pointer rests on the message. - Four nightly journey tests read the same titles: `test_render_anchors`, `test_render_threads` and `test_website_server` now pass. ## Still failing, and why - `test_obligation_contextual_bindings_are_independent_of_widget_bindings`: #5614 made a control's `aria-keyshortcuts` the union of every key that presses it (`controlShortcuts` in `scopes.js`, `reflectElementShortcuts`). It now names `x` and `y` on the obligation, where only `3` reaches the control, and `x` where a nearer dead declaration takes `x` from it. `bindings.js` still says the attribute describes the dispatcher's currently reachable routes, nearer reservations included, while `control-keys.js` says every key chip's key is in it. Which contract holds is a decision; the test is unchanged. - `test_a_playground_opens_its_instruction_over_the_page`: after the preview on the instruction's Copy is put away, the next Escape leaves the instruction popover open and only the one after closes it. The lost Escape reproduces in a probe at 84d9186, and is being fixed on a separate branch. - The three Leaf-fold tests in `test_render_floating_panel.py`, and `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice` (since #5618): each passes its assertions and errors at teardown, because the shift watch reports the preview's words moving without input as the preview rides its traveling target. The preview follows its target natively (`position-anchor: auto`, `showPopover({source})`), but the watch finds anchors only by name. Teaching the watch the implicit anchor didn't remove the finding. - `tests/journeys/test_render_files.py::test_file_editor_saves_quietly_and_preserves_inflight_edits`: passes its title step now, and since #5617 fails earlier: the editor's gutter moves without input after an external file update. Not traced further. - #5617's own push run ([42343843769](https://github.com/max-sixty/leaf/actions/runs/42343843769)) hadn't finished, so its breakage beyond the file journey is unknown. Two candidates are not from these PRs: `test_a_changed_diff_file_keeps_its_sideways_reader` and `test_trace_tree_opened_by_the_browser_keeps_its_match` each failed in one run only and pass singly at 84d9186, as does `test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in`. ## Checks - Each changed browser and journey test, singly, at the branch head: passes, both engines where a test takes one, except those listed above. - The preview, reference, key-scope and reaction tests near the code changes, singly: pass. - `leaf-dev probe --base`: the notification playground's slider previews "Concurrent release events" in Chromium and Firefox, and the motion playground's Time slider and speed select preview as at 84d9186. - `pnpm run check` and `pre-commit run --files` on every changed file: pass. > _This was written by Claude Code on behalf of max-sixty_
… wherever they show; the shift watch credits a preview riding its target (#5638) This fixes the causes left on `main` after #5614 and #5617 that #5629 didn't cover, and two gaps review found in the preview's Escape step. The file editor's gutter finding was not caused by #5617 (see **Left open**). ## Keys a control says #5614 made a control's `aria-keyshortcuts` and its preview's key chips name every key any row binds to it, wherever the user stood. A screen reader announces the attribute with no context, so it promised keys that did nothing. The Inspect button in `test_obligation_contextual_bindings_are_independent_of_widget_bindings` said `x y` while the user was on the suggestion, where only `3` presses it, and kept `x` after a nearer, unavailable declaration took it. Both now come from one reading: the dispatcher's reachable bindings from where the user is (`availableCommandRoutes`), each under the control its row or route names (`reachingNow`, `keyboard/control-keys.js`). The preview reads it as it shows. `paintCoreControls` writes the attribute each frame for the controls whose keys moved. The command hints read the same reading for their faces, and their separate per-frame `aria-keyshortcuts` projection is gone. Exports paint the attribute too. Behaviour changes against `main`: - Resolve says `r` only where `r` presses it, on its thread. With the caret in the reply, where `r` is typed, it says no key. - A focused control's own Enter and Space, the platform's press of any control of its kind, draw no chip. Its attribute still names them. - A close control says Escape only where a row says Escape presses it, as the image viewer's does. The floating panel's ✕, a margin card's and Page Map's say no key, since their Escape steps don't name the control, though Escape from inside those surfaces closes them. The panel field's Close, added in #5630, keeps its own `esc`. `test_a_control_previews_its_word_and_every_key_that_presses_it` asserted the old rule (a hover chip `r` with the caret in the reply). It now expects no key there and `r` once Escape leaves the reply for the thread. ## The preview's Escape step While a preview stands, Escape's first step puts it away. Three gaps broke that. **Inside an open popover.** In `test_a_playground_opens_its_instruction_over_the_page`, after Tab showed Copy's preview inside the instruction popover, the first Escape put the preview away, the second did nothing, and the third closed the instruction. While Escape has a step of Leaf's to take, the page holds a CloseWatcher (`keyboard/close-requests.js`), which it reads in the repaint frame. A standing preview is such a step, so the frame after the Tab made a watcher above the popover's own. Putting the preview away asked for no frame, so the stale watcher took the next Escape's close request and found nothing to do. The preview now reads the watcher again at once whenever its step comes or goes (`stepMoved` calls `paintCloseRequests`). That holds for a key and for Back alike, even with two presses inside one frame. **Back.** An earlier version of this branch refreshed the watcher from an Escape keydown listener, which ran ahead of `back_gesture`'s blocker, so the back-gesture tests got a refresh real Back never makes. That listener is gone. `test_a_back_gesture_after_a_preview_put_away_closes_the_popover_under_it` is the back gesture's form of the playground test. It and the playground test fail with `stepMoved` disabled, and pass with it. **Inside a modal dialog.** A preview of the image viewer's Close lost its first Escape, which closed the viewer and the preview together, in Chromium and Firefox; `main` does the same. The preview shows inside the topmost modal, but its scope had no root, so the modal's floor (`keyboard/dispatch.js`, `stack`) dropped it. The scope is now rooted at the preview itself. `test_a_preview_inside_a_modal_takes_escape_before_the_modal` fails in both engines without this. Letting the browser take the preview's Escape, tried before, closed the panel's thread view under the preview, so the preview keeps its step. ## A preview standing clear of news drawn beneath it In `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice`, the landed row's focus preview stood where news then drew the notice of a resolved thread, and the preview stood afresh clear of it, moving its words 330 px, which the shift watch reported. That move is the preview's deliberate answer to content arriving where it stood, as on `main`: a notice arriving exactly under a preview is a rare path, which may move the preview rather than carry a hold of its own (SOUL.md, "Keep the foundation small and extensible"). The test now asserts that the rows hold still behind the notice and that the preview stands clear of it, and consumes that one move by its preview nodes, as other tests consume a deliberate move; the watch itself is unchanged for everything else. ## The shift watch and a preview riding its target Three tests that fold the panel with a focus preview on the Leaf button errored at teardown. The browser carries the preview exactly with the button (`position-anchor: auto`, `showPopover({source})`), but the watch couldn't prove the preview anchored: - it found anchors only by name; it now also reads the `source` of the `showPopover` or `togglePopover` call that opened the popover, and only that call, since one made while the popover stands open leaves the browser's anchor as it was; - it read insets only with pixel offsets; it now also reads an offset from a custom property, and a script changing that property still reports; - it required every declaration that might be in force to be anchored. The preview stands under the chrome guard's `all: revert-layer` and its own `inset: auto`, and the guard's rollback branch read that `auto` without asking Typed OM whether the inset is still `auto`. This third gap is why the implicit-anchor patch from triage passed its own tests, which had no guard, and left the finding in place. The watch's anchor tests gain the preview's shape: a guarded popover on its implicit anchor, carried by its source's translation and by its source's scroll, clean and faulted, and one asked to show again with another `source` while open, whose independent move must still report. The clean cases fail on the old watch and on the triage patch alone, and the re-shown case fails with a wrapper that records every call's source. ## Left open - Escape steps other than the preview's still rely on the repaint frame to bring the close watcher up to date. With an `lf-draft` in an auto popover, two quick Escapes swallow the second, on `main` too. The watcher's sync belongs with any change to the step Escape has available, as the preview's now is (`stepMoved`). - The journey `test_file_editor_saves_quietly_and_preserves_inflight_edits` fails at line 142 intermittently, before #5617 as well as after: locally it reported the gutter in 2 of 4 runs at `ef6c01ed8` that reached that line, 0 of 2 at `84d918681`, 1 of 4 on `main` and 0 of 5 on this branch. Right before the external write the gutter matches its lines. The watch sees the two frames after it, where CodeMirror draws the gutter rows 16 px tall beside 24 px lines before its measure corrects them. So #5617 has no hunk to bisect to, and the fix belongs in how the editor applies an external update, or in what the watch counts as content that update replaces. - `test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in[firefox_browser-input]` fails intermittently on `main` as on this branch, run alone 1 time in 4 on `main` and 1 in 3 here. ## Checks `pnpm run check`, pre-commit on the changed files, and each changed or nearby browser test by node id in Chromium and Firefox where it runs in both: every test asserting `aria-keyshortcuts`, the preview's placement, focus, Escape, modal and back-gesture tests, the close-request tests, the playground, the fold tests, the Threads test and the watch's anchor tests. > _This was written by Claude Code on behalf of max-sixty_
The branch had merged dcb34de, an early head of the preview-owner work that later landed reworked in #5614 and #5618. A merge from the old base (6b3159d) would keep lines that round added and a later round removed. So this merge replays the branch's own change since dcb34de (its first-parent change-attribution commits, the three early ones thread previews carried and dropped included) onto main: the tree is `git merge-tree --merge-base dcb34de origin/main 7d282ed`, recorded with main as the second parent. Two conflicts, both import lists: change-walk.js takes main's `selectedBase` and comment beside the branch's provenance imports, and test_changes_in_place.py imports main's `told` beside the branch's `example_media` and `preview_parts`. The changed lines of `git diff origin/main` match those of `git diff dcb34de 7d282ed` apart from those two import lines. Main is still at protocol 42, so the branch's 43 stands; `pnpm run build:browser` leaves the baseline and every vendor bundle as merged.
…nd update three journeys for #5614's previews (#5748) This fixes the five nightly journeys that #5614 turned red. One failure was a runtime bug, and the other four were journeys written before #5614's documented behavior. **The runtime bug.** A focus preview describes what has focus through `ariaDescribedByElements`, which empties the `aria-describedby` attribute. On a link that opens in a new tab, such as an All pages row, `declared-words.js` read the empty attribute as an author change and wrote its "opens in a new tab" id back. That removed the preview from what a screen reader hears. When the preview went, its restore wrote that same id again, which is the `unchanged write: aria-describedby` the nightly reported. The link treatment now leaves the element references in place while they still hold its new-tab description. So while the preview stands, the row is described by both the new-tab words and the preview. Once the preview goes, it is described by the new-tab words alone. `test_a_focus_preview_on_a_link_elsewhere_keeps_its_new_tab_description` (browser tier) fails on main, where the row's references hold only "opens in a new tab", and passes with the fix. **Journeys that predate #5614.** #5614 says: "Escape puts away a standing preview before it does anything else, so after a Tab onto a control that previews, closing the surface takes two presses". It also says it updated `test_command_routes` and `threads/test_navigation` for this, but those runs don't reach nightly journeys. This PR updates the rest: - `test_all_pages_takes_the_keyboard`: the arrow walk leaves the row's preview standing, so `put_preview_away` comes before the Escape that closes All pages. Its 120 s timeout was that Escape being taken by the preview. - `test_a_diff_outlet_keeps_the_shared_attachment_controls`: focus on "Other responses" after a key shows its preview, so the bar closes on the second Escape. - `test_every_product_route_is_a_live_leaf_page` and `test_the_public_catalog_is_a_visual_index_of_full_page_routes` count one chrome root (`.lf-chrome` not inside another). #5614's preview stage is an `.lf-chrome` box nested in the root on purpose (`preview.js`, `stage`), so that the chrome sheet dresses the preview inside a modal dialog too. The two roots in the report were that stage, not a second runtime. No interface moves beyond what #5614 decided. <details><summary>Verification</summary> Each of the five journeys named in #5707 failed on main with the issue's diagnostic. All five pass on this branch, rebased on `57eb1d46b`, with `uv run pytest --run-nightly <node id>`, along with the new browser test. The external-link tests (`test_a_render_of_an_external_links_words_keeps_its_treatment`, `test_an_external_link_says_and_opens_where_it_goes`, `test_call_diff_projects_stable_commentable_rows`, `test_a_projected_external_link_gets_the_pages_link_treatment`), `test_a_preview_shown_on_focus_describes_what_focus_is_on`, `pnpm run test:runtime` and `pnpm run check` pass. </details> Closes #5707 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
…ept two ring cuts #5306 and #5614 chose (#6200) After #6193's sample updates, `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` still reported eight ring faults, which earlier failing samples had hidden. They have three causes. This PR fixes the one that is a real defect. For the other two, it updates the ring reader to accept outcomes that #5306 and #5614 chose on purpose. With this change the journey passes on main `3bc561561`. Without it, a tab walk over data-explorer, code-comparison and review-a-fix on that commit still reports all three kinds. **The trace's metadata scroller covered its own ring (review-a-fix).** `.lf-trace-metadata` wears its ring one band inside its edge, but it had no padding. Once #5306 drew every mark as the box's own outline, the scrolled words painted over the ring's left run. The scroller now starts its words a ring's room (5px) in, as the token's rule for an inset ring expects (`tokens.css`, "Where it stands"). On screen, this changes the review-a-fix trace's metadata pane: its text moves 5px right, and its focused ring's left edge shows whole.   **A full-height question's mark runs below the window (data-explorer, notification-playground, shadow-scale).** #5306 says so in its description: a question filling a full-height workspace wears its ring 3px outside itself and reaches the window's foot, "so the ring's bottom run falls below the window". `browser/AGENTS.md` rules out padding the page for a mark. The reader now skips that bottom run when the ring belongs to a box that isn't focused, isn't fixed, and ends the page at the window's foot. The focused control's own ring is still held to the foot. So is a fixed box: `test_the_ring_reading_sees_and_measures_a_ring_cast_as_a_shadow` plants an unfocused fixed box there and still passes. **A focus preview covers the question around its control (code-comparison, command-hub, motion-playground).** Since #5614, a keyboard step onto a control shows its preview. The preview stands clear of the control and of the controls the user could work next, and may cover the rest of the page. Here the "Show instruction" and "Copy Markdown" previews lie over the enclosing question's location ring. The reader no longer samples another box's ring under an open `#lf-preview`, but it still reads the focused control's own ring there. <details><summary>How each cause was dated</summary> The test's last pass in a scheduled run was `7cbf67854` (Oct 27). Runs from Oct 28 to Nov 3 failed on earlier samples, and the Nov 4 run already listed the full-height and trace faults. I ran `git bisect run` over a tab walk of the affected examples: - data-explorer and review-a-fix: first bad commit `ecf4dc10d` (#5306), clean at its parent `5bdc6fa9b`. - code-comparison: clean at `ecf4dc10d`, first bad commit `4248d1f4c` (#5614). Checks run on the branch: the journey itself, `tests/browser/controls/test_rings.py` (27 passed), and `tests/browser/test_render_playwright_trace.py`. In that last file, `test_trace_tree_opened_by_the_browser_keeps_its_match` failed once under `-n 3` on this branch. It also fails under `-n 3` on unchanged main, with the same row position (480 against a 12–111 band), so this change doesn't cause it. </details> Closes #6192 — automated triage Co-authored-by: leaf-agent <[email protected]>
Under the rule "Pointing reads; pressing acts" (
browser/AGENTS.md), pointing at a mark, control or value now shows what it says before the user presses it. A resting pointer, a keyboard step onto it and a finger held on it all show the same preview beside it: the control's name with every key that presses it as key chips, then lines of detail, such as where a thread stands, the whole of a label or path the page cuts short, or what a timeline mark recorded. A finger's long press reads and presses nothing, and a tap still presses. One owner,browser/runtime/preview.js, draws every preview in one face and stands it clear of its target, of what it is about and of every control the user could work next; it covers a control only where no side has room for a line, and then lets the pointer through to it. It replaces the margin entries' own labels, the held-word reveal, the folded Leaf button's status peek, the gloss's hover card, the trace timeline's tip, the diff row's path box and thetitletooltips on Leaf's own controls.Contract
An element declares what pointing at it adds as
lfPreview(route), with no import, as it declareslfCommands(skills/leaf/references/module-input.md, "Previews"). Leaf calls it as the preview shows on the"pointer","focus"or"hold"route, and again at each new presentation of the document while the preview stands, so its words follow the page. It returns{name, keys, detail, list, at, about, excerpt}, every field optional;nulladds nothing, so the search goes on to what holds the element;falseshows nothing here or around it.atis where the preview stands: the declaring element by default, another element, or a box in client coordinates inside the element, as a chart's point.aboutis an element the preview must leave in view, as a margin entry's passage or an edit time's message.list: {items, more}shows as many items as the room holds andmore(count)'s words for the rest.previewChanged(el)(portable-api.js) redraws a standing preview where it stands and never brings back one the user put away.previewChanged(el, {aim: true})says the user aimed at something new inside the element, as a chart's pointer or arrow key reaching another point, and shows the new target's preview whatever put the last one away.When a preview goes, for any reason, Leaf dispatches
PREVIEW_ENDED("lf-preview-ended") at the declaring element withdetail.route, so a mark the widget drew for the reading, such as a chart's ring, comes off.A control needs no declaration: it previews its accessible name where its face doesn't say it, and every key the register binds to it (
controlKeys,keyboard/control-keys.js), so Resolve showsrand every close control shows Escape.Where a preview stands
Where a preview stands is one decision (
stand), made again by one scheduler (decide) whenever its grounds may have changed: a new presentation, a resize of the window or of the box the preview stands by, a scroll of any box around it, and a pinch or an on-screen keyboard changing the part of the window the user sees. The browser draws exactly that decision through anchor positioning (showPopover({source}),position-anchor: autoandanchor()insets), with noposition-try-fallbacksto disagree with it.A side's room is the room it holds clear, inside the part of the window the user sees, of the box the preview stands by, of
about, and of every element whose access the user must keep (keepsAccess): what the page works, anything focusable, anything that scrolls, anything embedding a document, and whatever previews. Hit tests every 23 px across the box the preview would draw find that room. For a finger, below holds none, since the hand hides it.A standing preview keeps its corner while the clear room there holds a whole line, and its words are clamped to that room with an ellipsis, so words that grow never move it under the user's aim. Placed afresh, it takes the first side that holds it whole, in the order below, above, beside toward the nearer window edge, then centred; else the side whose room holds the most whole lines; else, where no side holds a line, the roomiest side over what it covers, letting the pointer through (
data-lf-covers); else over the target; else nothing.Routes
A pointer reads after a 200 ms dwell, and at once when it reaches another target within 400 ms of leaving one. A pointer's preview takes the pointer, so the user can cross onto it and read it there (WCAG 1.4.13).
A focus preview shows where the user moved focus, as the mover says through
focusDestination's cause: a Tab or a placement standing in for one (step), or a move to a place (move), such as a keyboard walk landing. A move into a surface opened since the user's last input shows nothing (openedThisInput, whichopenLayerinfocus.jsand every native layer record), and neither does focus handed back (return), so no preview stands in front of the Escape the user is backing out with. A focus or hold preview whose target is out of view waits until the target comes into view. A screen reader hears a focus preview as the focused element's description, except a control's own, which its name andaria-keyshortcutsalready say.A finger's hold reads at the platform's long press, its
contextmenu. WebKit's touch engines send none (WebKit bug 213953), so whereGestureEventexists the hold reads after 500 ms, UIKit's default (notes/browser-support.md, "A touch long press in WebKit"). Once the hold has read, the owner cancels the touch'stouchend, so the release presses nothing. The preview stands until the next press, and the platform's long-press menu stays shut while it does.While a preview stands, Escape puts it away and does nothing else (the
previewpage scope, first in the register's stack), and a second Escape takes the step the first would have. Since a preview often covers the first line of the surface the user is in, the user can put it away without also closing that surface.An author's
titlestays the writer's: a pointer over it gets the browser's tooltip and no preview, focus and a finger read its words in the preview, and Leaf neither writes nor removes it. Leaf's own controls write notitleon Leaf and declare their words as previews; the portable writers still write one off Leaf, where the browser's tooltip is the only reading.Read first
browser/runtime/preview.js, its header: the owner, its routes, and its decisions with the alternatives they rejected.browser/AGENTS.md, "Pointing reads; pressing acts": the rule.skills/leaf/references/module-input.md, "Previews": the contract a widget author reads.browser/runtime/chrome.css, the.lf-previewblock: the face, and how the decision is drawn.browser/runtime/focus.js(openLayer,openedThisInput) andbrowser/runtime/keyboard/control-keys.js(controlKeys).notes/browser-support.md, "A touch long press in WebKit".tests/browser/controls/test_previews.py.Trade-offs
titleread by keyboard or finger loses its tail, which the browser's tooltip and a screen reader still give whole.atbox inside itself can stand its preview over one of its own buttons. No shipped caller does this.GestureEventalso exists in desktop Safari, where no touch reaches a hold.interestfor, which gives a control the same three routes natively, was rejected because it ships only in Chromium.Behaviour changes against main
rand close controls show Escape, and the hand-written "(Esc)" and "(⏎)" suffixes are gone..and the page's status under it, and the unfolded one previews "Page menu"; the peek element now carries only passing notices.aria-descriptioninstead oftitle.aria-keyshortcutsnames every one-press key a control's chips draw, so Resolve's namesrbeside Enter and Space.Tests
Tests changed and why
tests/browser/controls/test_previews.pyis new: 29 tests of the owner's routes, contract, placement rule and hold, each written to fail on the commit before its change, in Chromium and Firefox wherever Playwright can drive the case there.tests/render_harness.pygainsPREVIEW,tab_onto(a script's focus no longer previews, so tests step on with the keyboard),expect_preview_words,preview_parts,preview_text, andlong_press, which sends thecontextmenua touch engine sends at a long press, since Chromium's injected touch sends none.titlenow assert the declared preview words, or thearia-labelwhere the title only repeated it: test_card_placement, test_status, test_activity, test_freshness, test_readiness, test_versions, test_render_floating_panel, test_render_outbox, test_render_pages, test_render_reactions, test_render_read_state, test_render_semantic_selection, test_seated_threads, test_on_panel, test_render_files, test_deck, and the runtime's action-offers test, which also checks that a title is still written off Leaf.lfPreview.test_a_transient_margin_entry_label_avoids_the_next_margin_entryis deleted, since test_previews holds neighbour clearance for every preview.test_dense_suggestion_labels_cover_no_neighboring_margin_entrybecomestest_dense_suggestion_labels_stand_inside_the_window, since the placement rule lets a preview cover a neighbour where no side's room holds a line, so standing inside the window is what every entry in a dense cluster is owed.test_a_held_reaction_says_its_word_and_the_release_decidesbecomestest_a_held_reaction_says_its_word_and_a_tap_reacts) and test_diffs send the long press, expect the release to press nothing and the preview to stand, and expect a tap to press.test_a_margin_label_covers_the_target_tracebecomestest_a_margin_preview_stands_clear_of_the_target_trace: the marker's preview is about its target, so it stands clear of the trace rather than painting over it.test_timeline_tooltips_keep_their_words_above_marks_inside_the_timelinebecomestest_timeline_marks_say_their_words_beside_them_inside_the_window, since a mark's preview stands clear of its lane inside the window rather than above the mark inside the timeline's width. It runs at 1400 px in Firefox too, and holds that the preview never covers its own mark, covers no other mark at a desktop width, and covers one only where it says so (data-lf-covers) and lets the pointer through, as at the end of a phone's input lane. The trace journeys read each mark's words throughlfPreviewand use the transport buttons' new names.dev/leaf_dev/states.pyadds thecontrol-previewstills state, Resolve's preview in a margin card.Checks:
pnpm run check(the build, runtime and Worker tests and the type checks), pre-commit, and the focused browser tests the change touches; the broad suite runs in this pull request'stestjob.