Repository navigation
Size changing labels from their room in CSS, replacing reserve() - #2852
Merged
Merged
Conversation
A label whose words change, such as a count or Approve's two states, kept one width by `reserve(control, labels)`: script cloned the control, measured each label in it, wrote `--lf-reserved-width`, and re-measured whenever a ResizeObserver on the root saw the face change. The measurement waited for a box, so an undrawn control reserved nothing (e8bf1b4), and the custom property served as a preferred width in some rules and a minimum in others (506a061). Now the element holding the label's words carries `data-lf-room`, the words it can show one per line. A shared rule in controls.css draws them in its ::before as an invisible block of zero height, so the element is as wide as the widest of them in the face it renders in, before any script runs and whether or not it is drawn. Generated content is not in the element's text, innerText or accessible name (checked in Chromium), so readers of `textContent` and tests asserting a control's text see only its words. The room sits on the element that holds only the words: Threads' label span, Approve's and On me's new words spans, the agent's On count, the thread narrowing counts, the blanket answers ("Accept all (N)"), the page search's match count, the diff's file count, and a thread's held-news notice. Banner buttons switch display per seat, and some use their own ::before and ::after, so the room goes on a span inside them. Approve's truncation moves to that span. `reserve`, its face tracking, the three callers' caches of what they had reserved, and every `--lf-reserved-width` rule are gone, with `reserve` removed from the widget API and module-authoring.md describing `data-lf-room` instead. Behavior changes: widths are no longer rounded up to whole pixels, so a control beside a former reservation can sit up to a pixel from where it was. The room is now a least width rather than a set one, so words longer than every room line widen their control instead of spilling past its border: On me at 100 or more, Threads or a blanket answer past 999. A held-news notice keeps at least the width of its first words while news stands, and widens for longer later news instead of truncating it at that width. Approve's projection test no longer checks the custom property, since nothing measures it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 14, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The shared room rule lets a held-news notice extend past its allocated space and cover adjacent thread controls. The inline suggestion preserves the notice's narrower width cap.
# Conflicts: # skills/leaf/assets/runtime/banner-status-view.js # skills/leaf/assets/runtime/thread/narrowing-view.js
The shared rule matched [data-lf-room]:not([hidden]) at the same specificity as .lf-thread-controls > .lf-thread-news and came later, so its max-inline-size: 100% replaced the held-news notice's cap and the notice could cover the thread controls beside it. Under :where() the owner's display and cap stand. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 14, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 14, 2026
Since #2852 a label whose words change kept the room of its widest expected words only as a least width, so words past it widened their control and shifted the banner beside it: On me at 100 grew from 90 to 96px, and a thread's held-news notice grew from "1 new reply" (58px) to "2 new replies" (68px) under the reader, undoing #1918's hold. Asked whether such a label should widen or be cut, the user chose to cut, since the shift is hard to oversee, and asked for a TODO to find the places where a cut is actively bad. The room is now the control's width. The element carrying `data-lf-room` holds its words in one child, which `controls.css` draws with no width of its own, filling the room and ending in an ellipsis. Every room owner gains that child: Threads, Approve, On me, the agent's On count, the blanket answers, the narrowing counts, the page search count, the diff's file count, and the held-news notice, which again holds the width of its first words and cuts longer news (its title keeps them whole). Cut words stay in the element's text, so the accessible name is whole. Approval's own truncation rule goes, since its room now cuts. The agent's On count no longer grows its room past one digit; its room is two digits (`On Claude: 99`), like On me's, so ten or more is not cut to `On Claude: 1…`. On me at 100 is cut to `On me: 1…`; the TODO entry starts there. `module-authoring.md`, `skills/leaf/assets/AGENTS.md` and the module headers describe the held room, and `controls.css` records the rejected least-width room. The held-news journey test now asserts the cut, and its existing check that the notice's box holds across news passes again. The banner tests that check Approval and the agent's count stay whole now read the words inside the room, since a cut there never reaches the control's own scroll width. The compact-status journey, which this branch's edit put in the PR's test run, expected the agent to be named "Agent" rather than the suite's "Claude" and failed the same way on main; it now expects Claude. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A label whose words change, such as a count or Approve's two states, kept one width by
reserve(control, labels): script cloned the control, measured each label in it, wrote--lf-reserved-width, and re-measured whenever a ResizeObserver on the root saw the face change. The measurement waited for a box, so an undrawn control reserved nothing (e8bf1b4), and the custom property served as a preferred width in some rules and a minimum in others (506a061).Now the element holding the label's words carries
data-lf-room, the words it can show one per line. A shared rule incontrols.cssdraws them in its::beforeas an invisible block of zero height, so the element is at least as wide as the widest of them in the face it renders in, before any script runs and whether or not it is drawn. Generated content is not in the element's text,innerTextor accessible name (checked in Chromium), so readers oftextContentand tests asserting a control's text see only its words.The room sits on the element that holds only the words: Threads' label span, Approve's and On me's new words spans, the agent's On count, the thread narrowing counts, the blanket answers ("Accept all (N)"), the page search's match count, the diff's file count, and a thread's held-news notice. Banner buttons switch display per seat, and some use their own
::beforeand::after, so the room goes on a span inside them. Approve's truncation moves to that span.reserve, its face tracking, the three callers' caches of what they had reserved, and every--lf-reserved-widthrule are gone, withreserveremoved from the widget API andmodule-authoring.mddescribingdata-lf-roominstead.Behavior changes: widths are no longer rounded up to whole pixels, so a control beside a former reservation can sit up to a pixel from where it was. The room is now a least width rather than a set one, so words longer than every room line widen their control instead of spilling past its border: On me at 100 or more, Threads or a blanket answer past 999. A held-news notice keeps at least the width of its first words while news stands, and widens for longer later news instead of truncating it at that width. Approve's projection test no longer checks the custom property, since nothing measures it.