Skip to content

Keep m's card clear of its words, and land m on a question in a card's answer as the thread lands - #6010

Merged
max-sixty merged 6 commits into
mainfrom
thread-placement-anchor
Nov 18, 2026
Merged

max-sixty merged 6 commits into
mainfrom
thread-placement-anchor

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Two cases where m (Next On Me) from far away left the user unable to read what it went to.

A long question opened over its words. A walk opens its card before its landing brings the words in from below the window, so the card chose its side and made its room where all the room was above the words, and the landing then carried the words up under it. A card is now opening once more for the first move Leaf starts in its scroller before any later input (scrollStarts, scrolling.js), so makeRoom runs again where that landing leaves the words. It reads the room where the page is headed (scrollGoal) and folds its move into the glide under way (glideTo), so the page lands once. The card keeps the side it chose: choosing again at the landing put a card under a tall obligation, over the choices test_walking_to_an_obligation_shows_its_discussion_clear_of_its_choices keeps clear. A scroll a later input makes, or one Leaf doesn't start, makes no room, so a growing card still never moves the page.

A question in an agent's answer stayed off screen. m to options in a card's answer, on words far below, focused them while the card stood by its words below the window, and the page stayed at its top: the card is fixed over the page, and the obligation's arrival scrolled the boxes around the question, which move nothing. The arrival now lands as an arrival at the thread does, in one step: into the card, then the thread's words centred unless shown, with the departure recorded so Back returns. That landing has one home, threadLanding (anchor-travel.js), which scrollToThread builds from too, landing on main's focus element for a drawing's part; offFlow (off-flow.js) tells a card from the floating panel, whose list keeps its own landing.

The branch also marks one option of leaf-dev placement cards' fixture choice selected. Since #6234 an lf-options asks without an attribute, so m from the top stopped at that choice, and the cell and widget cases timed out on main as well.

Evidence

  • leaf-dev placement cards --base against main: 7 of 51 case-windows differ, all at 1000×700. A long question, in each of the four Layouts, covers 81 px of its words' block on main and stands clear here; a question on a choice widget (21 px) and on a table cell (6 px) stand clear too. scrolled (the long question, then a 300 px scroll down) covers 81 px where main covered 20, under the kept rule that a card stays where it stood through the reader's scroll.
  • The two tests in tests/browser/margin/test_card_reply.py pass here and fail on main's runtime: the card stood over the words, and the options were focused but 0% in view. Reverting either fix alone fails only its own test.
  • pnpm run check passes, and 17 browser tests on obligation arrival, card placement and thread travel pass.

Known gaps

  • A key pressed between the card's first placement and the landing's first move cancels the reopen. A Shift pressed right after m didn't reproduce it.
  • Words in a pane inside a page that also scrolls: the reopen and makeRoom read only the boundary's scroller, so a landing that moves only the page makes no room. Inferred from the code, not probed.
  • A thread whose target isn't drawn has its card by the margin row and no place to land, so m there neither moves the page nor records a departure, as t doesn't.

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

…ring a card's question into view

Two cases where `m` (Next On Me) from far away left the user unable to read what it
went to:

- A long question on words below the window opened over them. The walk opens its
  card before its landing glides the words in, so the card chose its side and made
  its room while the words were still below the window, where all the room was above
  them. The landing then centred the words, and the card, held over them, covered
  them (the `words-long` case of `leaf-dev placement cards` in a 1000x700 window).
  Opening now lasts until the card stands after a landing the input that opened it
  makes (`chosenSince`), so `makeRoom` runs again there, reading the room where the
  page is headed (`scrollGoal`) and taking its move into the glide under way
  (`glideTo`), so the page lands once. The side is still chosen where the card
  opens: choosing it again where the landing leaves the words put the card under a
  tall obligation, over the choices `test_walking_to_an_obligation_shows_its_
  discussion_clear_of_its_choices` keeps clear. A scroll a later input makes, or one
  no input makes, makes no room, so a growing card still never moves the page.
- A question in an agent's answer, in the card of a thread on words far below,
  took focus while the card stood by its words off screen, and the page stayed at
  its top. The obligation's arrival scrolled the boxes around the question, and the
  card is fixed over all of them. The arrival now brings the card back with it
  (off-flow.js, `bringBackSurfaceOf`), as Tab does reaching a control in it.
  Rejected: bringing back a destination's surface in every travel landing
  (anchor-travel.js, `placeScroll`), which also ran for the thread walk's focus
  target and stopped its centre landing, so `m` landed a card's words at the
  window's foot under reduced motion and centred them otherwise.

`placement-rules.json`'s `size-page-still` says so. Two browser tests cover the
cases; both fail on main.
…ly on its opener's first landing

Review of the previous commit found each fix created a new problem, and probes
confirmed both:

- Bringing back the card after the obligation's arrival moved the page outside
  travel, so no departure was recorded: Back left the Leaf page, and `m` landed the
  card's words at the window's foot where `t` centres them. The arrival now lands as
  `scrollToThread` does, in one step: inside the card, then at the thread's words
  unless the window shows them, with the departure planned on the words
  (`threadDestination`, and off-flow.js `offFlow` to tell a card from the floating
  panel, whose list keeps its own centred landing). Rejected: opening the thread with
  travel before the obligation's own arrival. Under motion the second arrival's
  `stopScroll` stopped the first's glide, so the page stayed at its top.
- Reopening counted every scroll the reader is credited with choosing
  (`chosenSince`), including a single move layout doesn't explain and the end of any
  glide, so a script's 120 px scroll after `m` landed was undone by makeRoom with no
  input. It now counts moves Leaf starts in the card's scroller (scrolling.js,
  `scrollStarts`), and the first one the opening input makes reopens the card once.

The tests now also check that Back returns to the page's top after `m` reaches a
card's question, and that a scroll no input makes leaves the page where it went once
the long card stands; both fail on the previous commit.

The header's dated account of the incident moved here: a walk opened its card before
its landing, so a long card that chose its side over words below the window covered
them once they landed (2026-11-14).
…shares

The obligation arrival rebuilt `scrollToThread`'s landing by hand, and the copy had
already dropped its rule for a part inside a place taller than its room. Both now
build it from `threadLanding` (anchor-travel.js), so the next change to how a thread
lands is made once. The arrival also reveals the folds holding the obligation in
the card, as it did while the obligation was its own `where`.

The opening header now says what the reopen tests: the first move Leaf starts
before any later input, and a move Leaf doesn't start makes no room.
leaf-agent
leaf-agent previously approved these changes Nov 15, 2026
max-sixty added a commit that referenced this pull request Nov 18, 2026
…ree opens, and keep a reveal inside a workspace from moving the page (#6019)

Adds `examples/deploy-config.html`, "Finish a worker's production
config", to the catalog. A file tree lists a service's six deploy files,
picking one opens it in the file editor, and each saves to disk as the
reader types. Max asked for an example that features the file editor and
suggested combining it with the file tree's; until now both packages
appeared only on developer pages. He then used it and reported two
defects, both fixed here, and approved two follow-ups, both built here.

What changes for a user and an author:

- `lf-file-editor` takes several bindings (`binding="a b c"`) and
publishes a `files` output on the `file-list` contract, so
`<lf-file-tree for="editor">` follows it with no change to the tree.
Switching files keeps each file's caret, undo history and scroll. A link
opens a file, and can name a line: `#dc-editor:alerts:22` puts the caret
there.
- YAML is highlighted, through CodeMirror's `@codemirror/lang-yaml`
built in Leaf's pipeline, in the theme's code colors. Its module is
39,619 bytes (14,368 gzipped) and loads only when a YAML file opens; the
CodeMirror core grows by 7,599 bytes.
- A write from outside to other lines merges into an unsaved edit (a
line-level three-way merge; adjacent lines conflict, as in git). The
lines it changed are marked until the next such write or until the
reader edits them, and a rule marks the gap where it took lines away.
Every version written elsewhere starts the file's undo history afresh,
so Undo never replays earlier keystrokes onto text they were not typed
into.
- `leaf page state` lists a page's bound files under `files`, the name
the browser's state uses, with each one's label and path.
- An example can carry its files: a `<stem>.files/` companion and
`<stem>.files.json`, which `prepare_page` copies into the page directory
and binds. A file inside the page directory is granted by its path
relative to the page, so on leaf.page a visitor gets their own copy to
edit.
- **A reveal inside a held workspace no longer moves the page**
(`browser/runtime/landing-scroll.js`). Every region of such a workspace
runs to the window's foot and keeps room there for the floating panel,
so a landing measured it as taller than the visible band and scrolled
the page to bring its top up. Max's click on a file moved his page 49
px. It showed only where something after `main` gave the document room
to scroll, which is why no test had caught it. A landing now takes off
such a region only the room the region itself reserved (`--lf-end-room`
plus the root's landing room), never more than the panel's current band,
so content under an expanded panel is still brought clear. Picking a
file, a link to a file, and a link to a pane each moved the page 31 to
49 px before and move it 0 now.

To weigh:

- The landing fix is in the runtime, in a file draft #6008 also changes
(a separate hunk). A plain fragment link to a pane-filling element
(`#dc-editor`, a tab set's panel) still moves the page about 20 to 40 px
where the document has room: that route copies the browser's own
fragment rule in `anchor-travel.js`, which #6010 is changing, so it is
left with a recommendation to ask "already shown?" there too.
- `files.json` takes the page protocol's number as its format, now 50.
Grants written before read as absent, so those files need binding again.
- CodeMirror's YAML grammar doesn't tell numbers and booleans from other
values, so they take the string color, where code blocks color them
apart.
- Two of the site's rules stop the example short of a local page, and
both are left for Max: a visitor's edits last only while their container
runs, and every visit starts a container because the editor's first read
goes to it (3.3 to 7.5 s cold). The site path was checked on one machine
and not deployed.
- After an outside version merges into an unsaved draft, Undo no longer
reaches the keystrokes made before the merge. That is the cost of the
undo fix.
- Where one change both rewrites and removes lines, only the rewritten
line is marked and the gap gets no rule.
- It is a large change for one example: 54 files, +2,173 −342, reaching
the file routes, served state, the landing rule, the site build and both
packages.

Reviews: the building agent's own found six defects in the first version
and fixed them or listed them; Codex looked hardest at the relative-path
grant, the file routes and the merge, and found no way to read or write
outside what was bound and two performance defects, both fixed. A second
Codex review of the later commits found three defects, two of them also
reported by the review bot, and all three are fixed with a failing test
first: stale undo history after a write to a file the reader had left,
which could garble its text; the landing change discounting the panel's
whole band; and a mark on the unchanged line after an inserted one.

Checked with `pnpm run check`, the file-binding model tests, the twelve
files browser tests and the file-editor journey test by node id, the
nearby landing tests, `page check --render`, and `pre-commit`. Two new
tests fail on `main`'s runtime: a link to a held workspace's region, and
picking a file, each with room given to the document. A third holds the
other direction: a file picked under an open panel is brought clear of
it. The broad suite is left to CI.

> _This was written by Claude Code on behalf of max-sixty_
# Conflicts:
#	browser/leaf.js
#	browser/runtime/anchor-travel.js
#	browser/runtime/obligations/view.js
…cell and widget cases' threads

Since #6234 an lf-options asks with no attribute, so the gallery fixture's
choice became an obligation that m walked to before the threads on the
table cell and on the choice itself, and those six case-windows timed out
waiting for a card on every arm. An authored selected answers it, as the
fixture's unasking choice did before.
@max-sixty
max-sixty merged commit 1de0edd into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the thread-placement-anchor branch November 18, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants