Skip to content

Declare a message head's give-way order once, for every head - #5043

Merged
max-sixty merged 4 commits into
mainfrom
head-annotation-room
Nov 2, 2026
Merged

max-sixty merged 4 commits into
mainfrom
head-annotation-room

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A squeezed message head gives up its parts in one order: its hidden controls' room, then annotations such as the "Queued for Agent" receipt, then its time, then its name (the user's choice, 28 October). That order was three shrink weights spread over two stylesheets and scoped to margin cards, while the panel's, page threads' and the full thread reader's heads kept the name from shrinking and clipped the time with no ellipsis. The margin news fit also worked the order out again in script to decide when to hide a name. Now one block states it for every head.

  • The order (browser/styles/components/surfaces.css): one ordered block gives each part its weight: the controls' room (.lf-msg-control-room) 1e18, the metadata's annotations 1e12, the time and the metadata box 1e6, the name 1. Each weight is a million times the next, so a part gives up all its room before the next gives up any visible width. CSS can't take a weight from a rule's position, so moving a part swaps two weights. A primary reader's notice of news, which Lay out a thread message's controls as one group at its head's end #4717 put in the head's flow, shares the metadata's weight, so the two give way together as they did before. controls.css and annotation-chrome.css set no weights. Every head now cuts a squeezed time and receipt with an ellipsis and caps a long name at 40% of the head or 5em, whichever is wider, as margin cards did.
  • The news fit (#fitMarginNews, browser/runtime/thread/thread-card.js): it reads how much of each name the notice leaves as drawn instead of recomputing the order. A name cut below an em still hides (data-lf-nameless), now with clip-path, keeping its box. Before, its room went to the time, which showed a sliver of itself ("5." of "51d ago" on a 160px card). A whole name narrower than an em, such as "A", is no longer hidden.
  • The working head (browser/runtime/thread/transcript.js): its condition ("Stopped") was bare text the order's rules couldn't reach; it is now a span among the annotations.

Behavior changed in tests:

  • test_a_squeezed_head_gives_up_one_part_at_a_time is new. It narrows a queued message's head from 2000px to nothing and checks that the room, the receipt, the time and the name give way one at a time in that order, each giving all it can.
  • test_a_card_s_head_stands_whole_beside_news dates its message 51 days back. Under heavy load a run outlasted a minute, "just now" became "1m ago", and the shorter time stood whole on the phone.

Checked in Chromium and Firefox. Before-and-after stills of 22 thread, card and panel states differed only in a reply field's caret, and so did 11 of them taken again after the merge with #4717.

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

A squeezed head gives up its controls' room, then its annotations (a
receipt), then its time, then its name. That order was three shrink
weights in two stylesheets, scoped to margin cards, while other heads
kept the name from shrinking and clipped the time with no ellipsis, and
the margin news fit recomputed the order in script to decide when to
hide a name.

- surfaces.css lists the parts in order with their shrink weights, for
  every message head; controls.css and annotation-chrome.css no longer
  set any. A page thread's, the panel's and a primary reader's heads now
  cut a squeezed time and annotation with an ellipsis, and every head
  caps a name at max(40%, 5em), as margin cards did.
- `#fitMarginNews` reads how much of each name the notice leaves as
  drawn. A name cut below an em is hidden with `clip-path` and keeps its
  box; before, its box collapsed and the freed room showed a sliver of
  the time. A whole name narrower than an em, such as "A", is no longer
  hidden.
- New test `test_a_squeezed_head_gives_up_one_part_at_a_time` narrows a
  head to nothing and checks that no part is cut while one before it,
  in the order its computed weights give, still has room.
… hold the squeeze test to the user's order

A working head's condition ("Stopped") was bare text, an anonymous flex
item the order's rules can't reach, so a squeezed head cut its time
first. It is now a span among the metadata's annotations.

The squeeze test now asserts the order the user chose, and that each
part gives all it can by the time the head reaches nothing, so a part
that never shrinks fails it. A phone card's comment named the order
from before #4661; it points at surfaces.css.
#4717 made the controls' room an element (`.lf-msg-control-room`) with its
own `flex: 0 1e12 auto`. The order block in surfaces.css now names that
element first, and controls.css sets no weight on it. A primary reader's
notice of news, which #4717 put in the head's flow, gives way with the
metadata, as it shared shrinking with it on main.

The phone arm of `test_a_card_s_head_stands_whole_beside_news` now writes
its message 51 days back: under heavy load the run outlasted a minute,
"just now" turned "1m ago", and the shorter time stood whole on the phone.
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit f1b9ba7 into main Nov 2, 2026
4 checks passed
@max-sixty
max-sixty deleted the head-annotation-room branch November 2, 2026 04:44
max-sixty added a commit that referenced this pull request Nov 2, 2026
…ixes from a Firefox pass (#5039)

Eight fixes to Leaf's thread surfaces (the floating panel, the margin
card, widget seats and the Resolved fold), each one the user picked from
a Firefox pass over those surfaces at their window. The largest changes
where a thread opens on a phone: in the floating panel, rather than a
margin card placed for a narrow window.

## What changes for the user

- **Threads on a phone open in the panel.** On a window narrower than
the column with a rail on either side (`--lf-rail-room`, 958px with
Leaf's theme), every route into a thread opens it in the floating panel:
its marker, a tap on its words, `t`, Threads, the Page Map, a link, and
Send from a new comment. Margin cards stay a wide-window surface, so
card placement keeps no rules for a phone. Show on page folds the panel,
brings the passage into view and lands on its marker, whose focus
brackets the passage and from which a tap reopens the thread. A reply
being written moves between card and panel, with its words, caret and
undo history, as the window crosses that width, and focus moves from the
panel's view to the card's thread. The check asks the window, not the
page's boxes: a page that narrows its `body` keeps its cards on a
desktop, and `--col` stays unregistered, so a page may state its column
in any unit (a percentage leaves the room at 0px, and that page opens
cards at every width).
- **A draft in a card above its passage grows up over the messages.**
The card keeps its foot while the user writes, as it already did while
they read, so the passage stays in view below the card. It used to keep
its top, and a draft grew down over the words the thread is about.
- **A Resolve's notice names the thread it resolved.** The panel's row
says "Resolved “…” · Undo" for that Resolve alone: its Undo takes back
that Resolve even after another gesture has become the newest, and the
notice goes if the log refuses the Resolve. `z` after a shown Resolve
takes that Resolve, as the notice promised, until another key comes
between; then `z` starts again from the newest gesture. The notice
speaks in the field's own face.
- **Keyboard routes land on something drawn.** `g` then `Shift+T` from
the page stands Threads on its first row, and every view a key opens
does the same; a pointer still leaves the view holding focus. Escape
from a panel thread's reply lands on its view with a ring inside the
panel's edges. On me's Show on a question asked in a thread lands in the
card it opens. A pointer press on a held-news notice leaves the caret in
the reply. In a seat on the page, the reply being written then holds its
place, so the thread grows up from it.
- **The caret stays in a reply box after Send** (experimental). In a
card or a seat, the empty box Send leaves counts as written in only once
the user types there or comes back to it, so the answer they wait for
shows as it arrives.
- **Held news says one count, "N new", in the unread accent**,
everywhere it is held: a card, a seat, the panel and a seat's Resolved
summary. "2 new" keeps to the room "1 new" made, and the notice's
accessible name is that count.
- **A seat's box for a new thread stands a gap below the seat's
threads.**
- **Firefox no longer stops Tab on an empty layer.** The chrome's empty
foreground layer is out of the Tab order.

The `thread-choice-hints` still now opens its card by `t`, the route a
reader takes.

## Merging main

Two tests from main expected rules this branch changes: the Versions
view's tests expected `g V` from the page to focus the view, and now
expect its first version, as every view a key opens; a phone held-news
test expected per-reply facts, and now reads the one count. Main's
isolation of the held-news notice above the message head replaces this
branch's `z-index` for the same purpose, and main's one give-way order
for every message head (#5043) parts a head that drops its time from its
name once, which this branch did for margin cards alone; that test
stays. Main's placement sweep ran at 820px, a window that now opens
threads in the panel, so it runs at 1000px, the narrowest that opens a
card.

## Known gaps

On a phone, a marker standing for two threads opens the first in the
panel; the second is in Threads or a `t` away, where the wide-window
card has a 1/2 stepper.

## Tests

`pnpm run check:browser` and `pnpm run test:runtime` (742) pass. The
PR's first CI run failed nine tests this branch had not run locally,
each from its own changes; they now pass locally and in CI:

- The two smoke tests of a card's pending reply ran at 509x429 and
636x536, windows that now open threads in the panel, and run at 1000x429
and 1000x536. At every rail width tried, a card's transcript no longer
loses room after Send, the second test's named case, so its docstring
now says what it still holds.
- The choice-hints test moved to 1100x900: at 1000x838, Linux CI's
DejaVu faces left the card no room below its marker. Checked with DejaVu
injected locally.
- The margin card journey holds the reply box after Send rather than the
visible action, since the empty box the caret stays in shows Dictate in
Send's corner, in a box of its own size.
- The reading-position journey proves a seat's held growth by the
thread's height.
- `_draft_in_view` reads `:focus`: Chromium leaves a node moved by
`moveBefore` unmatched by its own `:focus-within`
(notes/browser-support.md).
- The panel's thread-view ring stands on a box of its own at
`--focus-ring-inset`, which `test_every_ring_stands_at_a_kind_of_box`
requires.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 2, 2026
The workflow test required a timestamp's `flex-shrink` to be zero,
contradicting #5043's intentional order: annotations give up room before
the time, then the author. Its failure showed both author and time still
inside their containers, and the captured phone view shows the timestamp
whole.

Replace the CSS implementation assertion with a rendered text-fit check
(`scrollWidth <= clientWidth`). The test still exercises Queued →
Delivered → On it and checks containment, node identity, absence of
reinsertion and absence of animation. This changes no product behavior
and preserves #5043's layout.

Validation: reproduced the reported assertion on main; the corrected
workflow test and `test_a_squeezed_head_gives_up_one_part_at_a_time`
pass (2 tests). Ruff checks and formatting pass.

Closes #5087 — automated triage

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants