Repository navigation
Keep the comment box and its card slim until a message stands taller than it is wide - #5991
Conversation
…ull measure The comment box opens at the card's least width and widens with the words typed in it, up to the card's own width, where its start stands by its text: right of the text, or under or over quoted words at their first character. Elsewhere it takes the card's width, as on main. The thread card keeps the measure whatever it holds, so the card Send opens starts where the box did and widens at its far edge. Behavior changed in tests: a short comment's box is 320 px wide and Send opens the card at the card's width from the box's start, where the card kept the box's width; test_send_grows_thread_around_the_words holds the card to the box's start and rows and to no less than its width.
… lines The comment box now keeps the card's least width (320px) however many lines are typed in it: Max asked that nothing widen while he types. Beside its text, a card stands at that width until a sent message runs past four lines there, then at the measure (592px) for the rest of the selection, so it widens once, from its start. A long comment widens the card Send opens; a long answer widens it as it arrives, or, held while the user writes a reply, as they send it. Progress steps don't count, so a card stays slim through them. Where a surface's start stands away from its text, both take the measure at once, as before. This reverses the guarantee that news never moves a card's controls for this one widening, which Max chose having seen that it slides Resolve, Close and the message controls 272px: browser/AGENTS.md says so, and the card declares `data-lf-widens` while slim, which tests/shift_watch.js credits. On his pages, a card stays slim in 7% of threads, opens wide for a long comment in 33%, and widens later in 60%, a median of 2 1/3 minutes after Send. A card already at the least width reads its messages before the fit writes, so a widening is one write rather than a narrow layout put back. Behavior the tests now protect: the box and the card Send opens share one width; a short answer keeps a slim card; a long answer widens it from its start; a six-line comment keeps a slim box and Send widens its card. The Send test's comment is one sentence, short of four lines, so it still checks that the words stay put.
leaf-agent
left a comment
There was a problem hiding this comment.
Progress steps do count toward the four-line test, which contradicts the description ("Progress steps don't count") and the NARROW_LINES comment. A pending run's earlier steps are drawn as ordinary MessageViews, each holding a .lf-msg-text, and the transcript folds them with keepsHidden(node, "until-found") (transcript.js, placed). Only the run's face is drawn apart, as .lf-thread-working-words. hidden="until-found" is content-visibility: hidden, not display: none, so reading scrollHeight inside it makes Chrome lay out the skipped subtree and returns the real height. I checked this in Chromium: a 300 px block of 200 words inside <div hidden="until-found"> reports scrollHeight 500. So a single progress step longer than about four lines at 320 px widens a slim card while it shows only the dim face. The same goes for messages folded under a closed "earlier messages" checkpoint. Each fit while the card is slim also forces layout of those hidden subtrees.
Counting only messages the card shows fixes both cases (suggestion inline). Opening a fold is a press, so a long message the user unfolds can still widen the card.
Max asked that nothing widen while he types. Over its words a card holds its foot, so an answer shows at once while the user writes a reply there (endNewsMoves); a long one now leaves the card at its width until they send, and their Send widens it. Beside its words the card already held such news behind its notice.
A run's earlier progress steps, and the turns under a closed checkpoint, fold with hidden="until-found", which still lays out when measured, so a long step that had folded away widened a slim card. The card now measures only messages with no hidden ancestor; unfolding one is a press, which may widen it.
leaf-agent
left a comment
There was a problem hiding this comment.
The new test_a_long_answer_waits_to_widen_a_card_while_its_reply_is_written passes its assertions but errors in teardown, so CI's test job will go red on it. I ran it three times on the merged tree and once at 262146f4f itself, and got the same error every time. The shift watch reports the card's head, its Resolve/Close/expand buttons and the first message's text moving up 26 px with no input, all in one frame:
v1.html: div.lf-msg-head moved without input by (0, -26)px; the same frame moved div.lf-box-ground.lf-margin-preview-ground
The evidence shows the card standing above its text (edges: {top: "bottom"}) and growing from 138 px to 164 px high at a fixed foot. Its top goes from y 47 to 21, which is the window's top bound, when the long answer arrives while "Which image?" sits in the reply box. So the foot-held card grows up under its own head, and none of the credits (permittedAppend's rising or foot-standing rules, permittedWidening) covers that motion here. The width hold this test checks does hold: the card's left and right edges stay put.
Two fixes could make this pass, and they mean different things. One is a shift-watch credit, if that upward growth is the intended "news shows at once while the user writes a reply" behaviour from the endNewsMoves header. The other is a runtime change, if the head and its controls aren't meant to move under a user who is typing in the card. The description says the user asked that nothing widen while they type, and a card that rises under its own head moves its controls in that same window.
Reproduce: uv run pytest tests/browser/test_render_send_placement.py -k waits_to_widen
…in four lines The test of a card over its words that keeps its width while a reply is written stood the card over the long paragraph's first line, so on CI's fonts the card met the window's top as the answer arrived and its head rose past what the shift watch credits. It now comments on the paragraph's last line, low in the window, so the card rises within its room; without the hold the test still fails. The inline-thread journey's wrapping comment was three sentences, which run past four lines in a box at the least width, so Send widened its card and rewrapped the words the journey holds still. One sentence still wraps.
|
Addressed in 8a8d59d: the test now comments on the long paragraph's last line, low in the window, so the card over it rises within its room as the answer arrives rather than meeting the window's top. The width hold is what the test checks, and it still fails without
|
|
On this runner the test still errors in teardown at Moving the comment to the last line doesn't give the card room, because the card isn't placed by the line. The evidence's selection still has For the test to leave the card room it has to scroll by the paragraph's top, so that roughly 160 px plus the top bound sit above it. Alternatively it could use a shorter block. The open question from the earlier review still applies: should a foot-held card that hits the top bound move its head under a user who is typing? Reproduce on Linux with DejaVu Sans as |
leaf-agent
left a comment
There was a problem hiding this comment.
test_a_long_answer_waits_to_widen_a_card_while_its_reply_is_written still errors in teardown at 8a8d59d8b. I got the same error in three runs on the merged tree, on Linux Chromium at the test's 1024×600 window. The card still rises into the window's top bound, now by 19 px instead of 26:
v1.html: div.lf-msg-head moved without input by (0, -19)px; the same frame moved div.lf-box-ground.lf-margin-preview-ground
The card doesn't stand over the last line, as the new comment says ("so the card stands over them, starting where they do"). The shift evidence has the subject and anchor as the whole p#long, with edges: {top: "bottom"}, so the card stands above the paragraph's top. The new scrollTo puts the paragraph's bottom at 80% of the window (y 480). Here the paragraph is 299 px tall, so its top lands at y 181. The 138 px card then sits at y 40, with only 19 px between it and the bound at y 21. The answer grows the card by 19.3 px, to y 21. So whether the test passes depends on how tall the paragraph renders. Where its line count differs from yours, as with this runner's fonts, the card again reaches the top.
To keep the test independent of fonts, scroll by the paragraph's top, for example el.getBoundingClientRect().top + scrollY - innerHeight * 0.5. That leaves the card about 300 px above it whatever the paragraph's height. Or open the card on a short block of its own. This also needs the comment above last_line corrected. The underlying question from the last review is still open: a foot-held card that meets the window's top while the user types still moves its head and controls with no input.
Reproduce: uv run pytest tests/browser/test_render_send_placement.py -k waits_to_widen
A card over a passage stands over its whole paragraph, so the room it rises in is the paragraph's top, which the last fix set by the paragraph's foot and so by its height in each runner's fonts. Setting it by the top leaves the card the same room whatever the paragraph's height.
leaf-agent
left a comment
There was a problem hiding this comment.
test_a_long_answer_waits_to_widen_a_card_while_its_reply_is_written still errors in teardown at a02d79dc4, with the same 26 px head rise as at 262146f4f. The scrollTo doesn't move the page. p#long starts about 188 px into the document, just below the h1 and #lede. That is less than the innerHeight * 0.65 (390 px) the scroll aims for, so the target is negative and the scroll clamps to 0. The shift evidence shows the paragraph at top: 188.33 both before and after the answer, which is where it sits unscrolled.
The card's foot sits 16 px above that top (edges: {top: "bottom"}, point.top: -16). So the 138 px card starts at y 47, and the answer's 26 px of growth takes it to the window's bound at y 21:
v1.html: div.lf-msg-head moved without input by (0, -26)px; the same frame moved div.lf-box-ground.lf-margin-preview-ground
No scroll can give a passage in #long more room above it, because what sits above the paragraph in the document sets that room. The case needs its passage in a block further down the document, or a page of its own with content above #long. I tried Element("#close"), which does get the room, but an element's card opens at the measure, so the first width assertion fails. A passage is the right kind of target here; it just needs to be in a lower block. The comment above the scrollTo ("from two thirds down the window whatever the paragraph's height") should change with it.
Reproduce: uv run pytest tests/browser/test_render_send_placement.py -k waits_to_widen
…scroll it The long paragraph opens the test page, so no scroll could lower it and the card over it met the window's top as the answer arrived, on CI's fonts. The test now serves the page with paragraphs above it, scrolls it two thirds down the window, and asserts that it got there.
|
Right,
|
… lines A card beside its text now stays at its least width until a message it shows stands taller than it is wide there, about thirteen lines in the slim card, instead of five. Max asked that the rule follow its aim, a big block of words, rather than a line count. Four lines widened a third of his comments at Send and 93% of answers; the shape widens 4% of comments and 56% of answers, and keeps 40% of his threads slim throughout. The comparison needs no line height or constant, so it follows the card's width and face. The width tests now use messages well short of or well past the boundary, and the Send growth and journey tests go back to main's comment texts, which stay slim. The writing-hold test gets a taller window, so its slim card holding a long answer stays clear of the window's top. tokens.css no longer says a card takes its lines' width.
# Conflicts: # browser/runtime/annotation-overlay/annotation-chrome.css # browser/runtime/annotation-overlay/comment-placement.js # browser/runtime/annotation-overlay/placement-rules.json
The threshold, a message taller than it is wide at the least width, was restated in five comments. placement-rules.json's `size-width` states it, `standsTall` keeps its reason, thread-preview.js's header records Max's choice of it on 15 November, and the token and comment-box comments point to `size-width`. No behaviour changes.
…5991's slim card in six tests (#6146) Fixes ten of the eleven browser tests #5991 turned red on `main`. #5991 keeps a thread card at its least width (320 px) until a message stands taller than it is wide. Four tests failed on a runtime defect it introduced, and six still expected the old card at the measure. **The no-op style write** (`test_open_in_panel_moves_the_cards_thread_and_its_reply_to_the_panel`, `test_pressing_a_page_mark_stands_in_the_thread_it_opens[near-fit]` and `[long]`, `test_a_card_at_the_windows_foot_grows_back_to_how_it_stood`). A new selection reused the card element with the width the previous selection left. Its first fit laid the card out at the least width to read its messages, found one standing tall, and widened the card back to the width it had started at. The style attribute ended unchanged, so the write watch failed. Now `select` clears the card's inline width, and the stylesheet stands an unsized card at the least width instead of the measure. The first fit reads the messages where the card already stands and widens it in one write. This follows #5991's own rule that another selection chooses its width afresh. On screen nothing changes: the fit lands in the same task's microtasks, before the frame paints, and an unplaced card is unseen. A cheaper fix, skipping the slim layout when a message already stands tall in the wider card, isn't enough. It still fails `near-fit`, where the same medium-length thread reopens: the message stands tall at 320 px but not at 592. **Stale width expectations** (`test_a_margin_card_clears_its_row_without_sacrificing_message_width[1440]` and `[2400]`, `test_a_card_under_a_containing_block_stands_beside_its_cluster[scale(0.25)]`, `test_a_thread_card_takes_the_room_its_window_gives_it`, `test_a_forced_inline_thread_keeps_its_control_reachable_on_a_crowded_cluster`, `test_a_head_s_words_take_its_controls_room_while_they_hide`). These asserted a card at the measure, or one reaching the window's edge, where each thread holds only short messages. They now expect the least width. Their placement assertions are unchanged: placement still reserves the measure the card may widen to, so where the room past the cluster is short of it, the card still stands beside the words. The head test picked a window where the margin caps the card short of the head's words. With a short comment, the card now stood at 320 px, narrower than that cap. Its comment now stands tall, so the card widens to the cap again, and the test again proves that the head lends its hidden controls' room to its words. Each of these tests failed on `main` before the change and passes after it, run by node id. So do #5991's own tests in `test_render_send_placement.py` and `test_render_aim.py`, `pnpm run test:runtime` and `pnpm run check`. **What this leaves.** `tests/browser/threads/test_summaries.py::test_a_root_summary_keeps_thread_actions_outside_its_fold[1440-False-2]` stays red. In a slim card, the summary header sits in the grid's first track beside the card's actions and Next unread on every line. So "Earlier discussion" wraps, and the disclosure, though it moves to its own line, still truncates to "Show 2 …". Fixing it means choosing which part gives way, so it waits on that choice in #6139. Refs #6139 — automated triage Co-authored-by: leaf-agent <[email protected]>
Closes #5595 Every element Leaf names now takes its name from markup it opens with, as a section is named by its heading: a tab, a part, a board column, a sample, a pane, a text document, a worktree, a playground control, choice and preset, a timeline run, lane and event, and a trace with its bookmarks. The registry's `x-name` key is gone, with the `label` attributes it pointed at, the `$attributes` entry that kept `label` as a name on every widget (`NAME_ATTRIBUTE`), and the `summary` attribute of tabs and parts. ```html <lf-part id="part-readme"> <header> <strong><code>README.md</code></strong> <p><span class="added">+120</span> <span class="removed">−45</span> lines</p> </header> <article class="layout-column">…</article> </lf-part> ``` The list of parts shows `README.md` in code type over the coloured diffstat. ## The rule and where it lives An element's name is its leading title: a leading `<summary>`, heading or `<strong>`, looked for inside a leading `<header>` or `<hgroup>` too. The rule already named sections, disclosures and titled members, and now names widgets. A widget that draws, moves or hides its name takes it only where it opens the widget: the title, or the `<header>` or `<hgroup>` holding it, is the widget's first element. A quoted sample whose heading follows its first paragraph keeps the heading where it stands, and a tab whose heading follows a paragraph is unnamed, which `page check` refuses. Where a name is only read, as a section's heading after an eyebrow or an option's title after its chips, it may follow those elements, as on main: requiring it to open them too would have unnamed 41 options, 66 sections and 39 list items in the corpus. Each runtime states the rule once: - **Browser**: `leading-title.js`. Packages get one reader, `openingTitle` (`portable-api.js`, and through it `widget-api.js`), which returns the name an element opens with as `{title, holder}`, or null: the title naming it, and the holder, its first element, which is that title or the `<header>` or `<hgroup>` around it. The board, tabs, text document, worktree, playground, timeline and version diff read names through it, and a widget draws, moves or hides the holder. `leadingTitle`, which reads past an eyebrow or an option's chips, stays internal to the runtime. `addressable-names.js` reads the name's words as the author wrote them (`addressableName`) and copies a node's markup without ids or generated words for a surface that shows a name away from its element (`echoCopy`). - **Python**: `gesture_words.leading_title_node`, `leading_title` and `leading_title_holder`. `tests/name_cases.json` holds both runtimes to the same names and the same holders. - **CSS**: one selector, `:first-child:is(summary, h1, h2, h3, h4, h5, h6, strong, header, hgroup)`, the holder `openingTitle` returns. CSS can't see text, so it also matches a title that loose text precedes, as `strong:first-child` did on main. ## How each widget shows its name - **Tab strip along a row** shows only each panel's name, so the panel keeps its `<strong>` or `<header>` as the eyebrow over its first heading, in the reading theme's `.eyebrow` face, and the block under the eyebrow takes the panel's top edge as the first block would. The tab's copy is an echo (`says: "echo"`), so a comment on the name anchors in the panel. A panel named by a heading keeps the heading as it is. - **Side list and a page's parts** show the name with the summary under it, so on screen the panel hides its name and the list's copy is the page speaking (`says: true`): page search finds the name in the list and a comment on it anchors there. On paper the list is gone and each item prints under its name. A side list reserves a summary's line before upgrade from a panel's header, so a phone's row strip keeps its height when the module draws. - **Column, sample, pane, text document, worktree**: the authored name stands where the widget draws one. A text document's name heads its frame and names its figure. A worktree's `<strong>` stands in its row's room from first paint, before the module slots it into the row. A pane's region is named by its header's title unless its author gave it an `aria-label`. - **Playground control, choice and preset**: the name stays the element's first child, hidden once the playground draws, and the view draws a copy as the radio's label or on the preset's button. The playground refuses a name holding a link, a control or a widget, which the copy would nest inside that control. Its list of such tags and page check's are held together by `tests/nested_name_cases.json`, which both runtimes answer. - **Code block, chart, draft, diagram, diff**: a widget that draws its own content keeps the name it opens with over what it draws. The four light-DOM modules put the holder back first when they replace their children, and `shadowStage`, the runtime's helper for a shadow-DOM widget, keeps it in the light tree and slots it alone at the top of the stage, which covers the diff, the file tree and the file editor. - **Places that take only text** read `addressableName`: every tab's and pane's `aria-label`, a thread card's heading, the timeline's chart labels, the trace chooser and the board's announcements. Each panel is labelled by its tab. ## Checks - Under `x-content: members` and `data`, a widget may open with the element its name stands in, a title or a `<header>` holding one, before its members or its `<pre>`. A `<header>` with no title names nothing and stays a stray member. Which widgets take a name is what their modules keep: `page check --render` reports a name a module drew over (`dropped-name`), so a package's module that drops one hears it, with no per-widget key. - A revision that renames a tab, a part or a pane replaces the widget, as one that changed its `label` did: a members-patched widget's shell holds its own opening name and each member's whole. - `page check` refuses a view whose name doesn't open it (`unnamed-view`), and a link, control or widget in a view's header, which its tab, a control, copies (`interactive-name`). Another widget's name is drawn in place or read as words, so a question's heading or an option's title may link a pull request. - `x-says` is a list of attribute names, each said after the element's words. Its `before` edge served only the column and sample labels this change retires. ## Evidence - **Corpus**: all 57 pages under `examples/`, `examples/developer/`, `docs/` and `tests/fixtures/pages/` build and pass `leaf page check`. - **Tests**: `pnpm run test:runtime` 992 passed; `pnpm run check:browser` clean; the touched model tests (959) pass; 191 browser and journey tests across the tab, document, workspace, playground, sample and version-diff files, the worktree rows, the pane names, the anchors selections, and the four tests CI failed on the first head pass. - **New tests**: a comment on a side list's name anchors on the list's copy and survives a revision (fails on `says: "echo"`); an author's `aria-label` names a pane (fails when the header always wins); a quoted sample's heading after its first paragraph stays a heading (fails on the lenient selector); a tab whose heading follows a paragraph is refused; a playground refuses a link in a preset's name; a code block, a draft and a diff keep and show the name they open with; a revision that renames a tab reaches its strip and one that renames a pane its region (both failed before); the render gate reports a widget that draws over its name; a removal that empties a nameless box stands in it, the version diff's `gapIn`, which kept no test once a tab keeps its name. - **A stale journey**: `test_render_shift_watch.py`, which this branch edits and so CI runs, expected a message head to say "just now"; since #6097 a head says its clock time, so the journey now advances days ("Yesterday 22:10", "13 Nov 22:10") and still holds the thread in place. - **Probes**: a printed queue (`alert-review`) shows each item's header under its group, where main printed the group and label together; a named text document's figure reads as `figure "Reviewed"`. - **Page search** on the root parts (`root-parts`): Workbench 4, Evidence 6, Plan 7, as on main. - **Stills** (`leaf-dev stills --authored` against main; Chromium and Firefox light, Chromium dark): the side list and the root parts are pixel-identical to main. Both text documents' caption bars match main in both schemes. A worktree's first paint differs only by its name standing in the row's room, which main leaves empty, with its body where main's is (Chromium only, since Firefox can't hold the runtime). The gallery's page of parts gains the `README.md` part, in code type over +120 −45. Each horizontal tab panel shows its name as the eyebrow over its first heading, in the face of a section's eyebrow under it: the root tabs, the gallery and a boxed set. A printed queue (`printed-queue`, new) prints each item's group, then its name and summary, where main printed the group and name on one line. A quoted sample whose heading follows its first paragraph keeps the heading where main does (`leaf-dev probe` pair). - **Evals** (Claude Code, paired base): every head sample (8) wrote each name as markup and passed `page check`; base wrote `label` attributes. Rubric results, head vs base: queue 1/1 vs 1/1; presets 2/3 vs 3/3; parts 0/4 vs 3/4, every head sample choosing a `layout-sidebar` with a contents outline, which the rubric then refused and accepts since #6111. ## Calls Max may reverse - **The eyebrow takes a `<strong>` or `<header>` name only**; a heading that names a panel stays a heading. - **`x-says` became a list** rather than a map whose only value is `after`. - **A text document's caption bar keeps the figure's ground**: code's under a source capture, the page's under a preview's tabs. Dropping the ground made a source capture's caption paper where main's is white. - **A widget draws only a name that opens it, and only where a widget draws its name**; reading a name stays as lenient as main's, past an eyebrow or an option's chips. - **Only a view's name is required** (`unnamed-view`); columns, controls, choices and events may go unnamed. - **`lf-event` and `lf-trace-bookmark` declare `x-content: members` with no members** to hold only a name. ## Adds - `openingTitle` in `portable-api.js`, returning `{title, holder}`; `addressableName` and `echoCopy` in `widget-api.js`, documented in `module-reading.md`. - `tests/nested_name_cases.json`, which the validator's `nested_in` and the playground's `nestedIn` both answer. - The findings `unnamed-view` and `interactive-name`; the content-model rule that admits a leading name; the playground's refusal of a name holding a control. - `slot="lf-worktree-name"` on a worktree's authored name, and `slot="lf-name"` on the name of a widget `shadowStage` stages; the `parts-list` and `printed-queue` stills states. - The render finding `dropped-name` (`droppedNames`, `render-checks/words.js`). ## Not verified - Page search finds a worktree's name and its branch separately, but no query spanning both, which it did when both were the row's generated words. - Option labels, board card titles and the quiet word's seat still read `:scope > strong`, a lookup that predates `x-name` and agrees with the rule wherever no text precedes the title. - `tests/journeys/margin/test_card_placement.py::test_the_shipped_long_thread_keeps_the_margin_and_its_height` fails here with a 320 px card where it asks for 379: #5991, on main, made a card slim at 320 px until a message stands tall and left this assertion as it was. It fails without this branch's thread-card change too.
…rds (#6680) `leaf-dev placement cards` flagged every slim card as narrower than it could be. Since #5991 a card beside its words stands at the least width (`--lf-thread-card-min`, 320 px) until a message it shows stands taller than it is wide, and it declares that with `data-lf-widens`. The gallery measured a card only against its words, the measure and its room, so on today's main in Firefox 17 of its 54 captures carried a warning such as "160 px narrower than its room" for a card standing exactly as the rule says. The reading now takes the least width as one more limit for a card that declares `data-lf-widens`, read from the card itself rather than restating the rule, so the gallery follows the runtime if the rule changes again. On a ref before #5991 no card declares it, and `--base` reads as before. Checked with a full Firefox run on this branch: the slim-card warnings are gone, and every other flag (the cards that cover a subject they can't share the window with, and the kept `scrolled` case) is unchanged. > _This was written by Claude Code on behalf of max-sixty_
…nside the card (#6839) Closes #6139. `tests/journeys/margin/test_card_placement.py::test_the_shipped_long_thread_keeps_the_margin_and_its_height` has failed in the nightly run since #5991, first on `assert 320 >= 379`: it still expected the card at the measure's width. #5991's rule keeps a thread card at its least width until a message it shows stands taller than it is wide (`standsTall`, `comment-placement.js`). The tallest message in the shipped long thread, the agent's checklist, stands 249px tall in a 290px text box, so the slim card is right and the test was stale, as six of its siblings were before #6146. Past that first assertion the test held two more expectations that later changes had made stale, which the nightly run never reached: - At 1436×1000 it expected the card to reach the window's edge. The slim card now ends 14px short of it, so the test expects the least width, inside the window. - At 1280×600 it waited for the reply's editor and Send to stand inside the card's thread box. Since #6773 a card's reply box runs over the card's padding to its sides and foot: 2px inside the card's edge and 5px past the thread box. The test now waits for them inside the card. Both card-width checks read the least width from the runtime's `cardMinimum()`, as `test_render_send_placement.py` does, rather than hard-coding 320. Both also check that the card crosses its controls (`cardLeft < controlsRight`), which the docstring promises and nothing checked. The test fails on `main` and passes with this change, run by node id: `uv run pytest "tests/journeys/margin/test_card_placement.py::test_the_shipped_long_thread_keeps_the_margin_and_its_height" -n0`. > _This was written by Claude Code on behalf of max-sixty_
The comment box widens with its first line again, from the least width (320 px) up to the measure (592 px), then wraps; the card Send opens starts at the box's width, so the comment keeps the line breaks it was typed with. #5846 had removed the earlier growth because the card kept the box's width and wrapped every long answer at 320 px; since #5991 a tall answer widens a slim card, which removes that problem. Width comes from CSS intrinsic sizing (`width: max-content` between `min-width` and `max-width`) rather than script. | | main | this branch | | --- | --- | --- | | Typing a one-line comment | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/typing-before.png" width="400"> | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/typing-after.png" width="400"> | | The card Send opens | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/sent-before.png" width="400"> | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/sent-after.png" width="400"> | What the diff doesn't show: - A change of the box's width alone no longer asks its placement (`box-motion.js`, `changed`): the words widen it inside the room the placement gave it. So the placement reserves that room when it places the box: it stands clear of chrome such as the floating panel across every column the box may widen into (`comment-placement.js`, `overflow`), and the comment box's watch also hears the pane that bounds it. - The box widens only from the edge its placement holds when that is where its words start (`comment-placement.js`, `widens`); elsewhere (left of the text, right of right-to-left text, dragged in a right-to-left page) it takes the measure at once. A draft long enough to scroll also holds the box at the measure, since CodeMirror draws only the lines near what shows. - Cost: a key that widens the box takes 1–2 ms more main-thread time (`leaf-dev bench --input draft`), most of it the text field re-reading which words reach Send's corner; it doesn't grow with the page. Two behaviours were put to the maintainer, who kept both as built: - **Send under a mouse.** The box is exactly as wide as its words, so Send, which stands in the corner the words leave free (#4714), hides while a one-line comment fills the box (above, right); Enter still sends. Keeping Send's room on every line, as under a finger, would end every comment's lines about 30 px earlier. - **A card reopened later.** The card Send opens starts at the box's width (left); reopened later it starts at the least width (right), so reopened cards stay as slim as before. Opening at the first message's width would cost a measurement each time a card opens. | Just after Send | Reopened later | | --- | --- | | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/reopen-sent.png" width="380"> | <img src="https://gist.githubusercontent.com/max-sixty/edff8c80bd56f00079829fe55a6efb8a/raw/27cf6416e9bf2eaef11be97649212f7155c18d20/reopen-later.png" width="380"> | The maintainer asked for this change and chose both behaviours above; Codex reviewed it three times. New tests cover the widening and Send's line breaks, a key that widens drawing at once, right-to-left pages (by `dir`, by CSS, and dragged), a scrolling draft, a narrowing pane, and clearance from the panel; about 190 focused browser tests, the runtime tests and `pnpm run check` pass. > _This was written by Claude Code on behalf of max-sixty_
The comment box keeps the card's least width (320 px) however many lines are typed in it, and a card beside its text stands at that width until a message it shows stands taller than it is wide there (about thirteen lines), then at the measure (592 px) for the rest of the selection. A comment that tall widens the card Send opens; a long answer widens it as it arrives, or, held while the user writes a reply, as they send it. Progress steps don't count. Where a surface's start stands away from its text, both take the measure at once. #5846 had opened every box and card at the measure, which stood a short comment in a mostly empty card.
What the diff doesn't show: the card's one widening slides Resolve, Close and each message's controls 272 px with no press, which
browser/AGENTS.mdruled out. Max chose it having seen that, called those controls secondary, and asked that nothing widen while he types. The card declaresdata-lf-widenswhile slim andtests/shift_watch.jscredits that widening alone. The threshold is a shape rather than a count, stated once insize-width(placement-rules.json) and measured bystandsTall(comment-placement.js), so it follows the card's width and face. On his pages a card stays slim in 40% of threads, opens wide for a long comment in 4%, and widens later, at a long answer, in 57%.Max asked for slim surfaces and reviewed this rule on a Leaf page, with captures of each moment and of answers of 6, 11 and 16 lines at both widths, and approved it.
Tests: Send keeps the box's width; a short answer and a folded long progress step keep a slim card and a tall answer widens it from its start (failing without the shift-watch credit); a tall answer that shows while the user writes a reply leaves the card's width until Send; a tall comment keeps a slim box and Send widens its card; a box away from its text takes the measure.