Repository navigation
Keep a comment box through a scroll away and back, and fail any test that loses typed words - #1496
Conversation
…that loses typed words
A comment on an item (⌥-click, `c` at a standing item, a visual's Respond to…) put
itself away, words and all, as soon as its item scrolled out of the window: every
scroll re-placed the bar through `refreshFab`, the item's box was read clipped to the
window (`shownRect`), and a failed placement meant dismissal. A quoted passage
survived only because its box was read unclipped.
Geometry now says where the bar stands, never whether. The item's box is read in
the page's plane (`pagePlaneRect`), so an item scrolled off screen takes the bar with
it, focus and caret kept, as a passage already did. A bar with genuinely nowhere to
stand, such as a pane scrolled past its target, is withheld (`withholdFab`) rather
than put away, and stands again with the focus returned when there is room
(`standFab`). The bar goes only when its subject leaves the document or a gesture
closes it.
The rule is written down beside Stability ("Words stay where they were typed") and
enforced the way Stability is: `tests/words_watch.js`, installed on every test page,
reports typed words that leave the screen without a key or press after the last
edit. `judge_shifts` becomes `judge_watches` so both watches judge as a test body
returns. `test_words_in_a_box_survive_scrolling_away_and_back` scrolls every corpus
page's scrollers to both ends and back with each typed box open; seven corpus pages
fail it on the old runtime.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ch off idle pages Review follow-ups. The bar waiting out of view is `fabWithheld`, set by `withholdFab` and cleared by whichever placement brings the bar back into view (`stoodAgain`), which also hands the focus back; it no longer infers the state from an inline style, so a repositioning that already hid the bar still holds the user's place. It keeps the side it stood on, so it returns where it was. While it waits, the composer's scope and the selection rung stand down: Tab no longer opens the choices of a field nobody can see, and Escape no longer closes it; `c` brings it back. `words_watch.js` asks for frames only while a field holds words, through the browser's own `requestAnimationFrame`, so `test_a_page_at_rest_does_nothing` and the tests that count a page's frames see none of its. A press on the field itself, a modifier, and a key that moves the caret, focus or page no longer excuse a later loss, and a key or press counts only within two seconds of the words going. The corpus test reads the words only where they are visible, asserts the focus came back to them, and keeps its pages open so the fixture judges every loss. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…position `c` brought a bar waiting out of view back only because its hidden box happened to measure under the bottom bar; a surface now declares `away` to off-flow, and the bar is away while withheld. The withheld state clears wherever the bar is put away, and the words watch dates a loss by the clock rather than the frame. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…sses still to fix The words watch now counts a key from its keydown and lets a following `beforeinput` take it back as typing, so a test's Escape that ends a few milliseconds before the fixture judges still counts; a chord counts whatever the field makes of it, since Linux's Chrome hands a contenteditable the line break of a Control+Enter the page sent on; and storage news from another tab of the page counts, being the same user's edit there. Behavior that moved, and the tests that say so: a diagram's response bar whose target its own scroller carries off waits out of view and comes back with the focus rather than retracting (test_a_visual_action_follows_its_own_scroller_until_the_target_is_gone), and a diff line's comment whose file is folded away waits and stands again when the file is opened, rather than closing with a "Draft kept" notice (test_a_data_bound_diff_aims_and_selects_one_source_line). The busy-delay draft test presses Save as a user does instead of by script. `known_shifts.py` becomes `known_faults.py`, which also names the three tests whose thread, settled by another actor, still takes the reply box and its words with it: a defect waiting on its fix. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # tests/AGENTS.md
… frame A sample's host page drives the sample inside it, so a press there that clears a field in the sample is the user's, as shift_watch.js already counts it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The words watch misses a loss in the same typing turn. look() samples the field only on the next animation frame; when an input handler immediately clears its value, words.trim() is empty and the edit is removed without a report. I reproduced this with a textarea whose trusted input handler sets value = "": typing x left an empty field, and lfWordsJudged() reported no loss. This is a direct gap in the new rule that tests fail when typed words disappear without another gesture. The watch needs to retain the edit's text before a same-turn clear can erase it, with a case covering that sequence.
… same turn Review: the words watch read a field only at the next frame, so an input handler that emptied it in the edit's own turn left nothing to report. The edit's own input is now read ahead of the page's handlers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # tests/AGENTS.md # tests/render_harness.py # tests/shift_watch.js # tests/test_render_shift_watch.py
main's lint fails on it since c37ebe8; this PR's lint runs on the merge with main. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Two notes now each preview a playground.html, and the second copy landed on the first's directory. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The new input capture still misses a same-turn loss when a handler clears the field and dispatches a synthetic input event. In Chromium, typing x into a textarea with that handler leaves it empty, and lfWordsJudged() reports nothing. The later event overwrites the text captured from the trusted edit; the watch should retain the trusted edit's words.
Review: a handler that empties the field and announces it with an input of its own overwrote the words the trusted edit left, so the loss went unreported. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # tests/test_interact_product.py
A comment on an item (⌥-click,
cat a standing item, a visual's Respond to…) put itself away, words and all, as soon as its item scrolled out of the window. Every scroll re-placed the response bar throughrefreshFab; the item's box was read clipped to the window (shownRect), so an item off screen had none, and a failed placement meant dismissal. A quoted passage survived only because its box was read unclipped. The same shape goes back to at least #181.The fix (
skills/leaf/assets/runtime/composing/surface.js)Geometry now says where the bar stands, never whether it stands.
pagePlaneRect), so an item scrolled off screen takes the bar with it, focus and caret kept, as a passage already did.fabWithheldstate, set bywithholdFaband cleared by whichever placement brings it back into view (stoodAgain), which also returns the focus. While withheld, the composer's keys and the selection rung stand down, andcbrings it back (off-flow's newaway).anchorStands) or a gesture closes it.Keeping it: a rule and a watch, as Stability has
skills/leaf/assets/AGENTS.md.tests/words_watch.js, installed on every test page besideshift_watch.js, reports typed words that leave the screen without a key or press after the last edit, including words a page's handler empties in the edit's own turn (it reads the trusted edit'sinputahead of the page's handlers). A typing key, a modifier, a caret, Tab or scroll key, a press on the field itself, a scroll, a resize and the server's news don't count; a chord, a press in a same-origin page holding the frame, and storage news from another tab of the page do.judge_shiftsbecomesjudge_watches.test_words_in_a_box_survive_scrolling_away_and_backsends every scroller on each corpus page to both ends and back with each typed box open (a comment on an item, the page's comment, a thread card's reply) and requires the words and the focus back. Seven corpus pages fail it onmain.known_shifts.pybecomesknown_faults.py, which also lists (KNOWN_LOSSES) the three tests whose thread, settled by another actor, still takes the reply box and its words with it. That and three other follow-ups are inTODO.md.Behavior that moved
test_a_visual_action_follows_its_own_scroller_until_the_target_is_gone).test_a_data_bound_diff_aims_and_selects_one_source_line).test_a_draft_wait_only_paints_after_the_shared_busy_delaypresses Save as a user does instead of by script.The nightly job ran on this branch twice; the remaining
tests/test_site.pyfailures (how-it-works's diagram parts) fail onmaintoo.🤖 Generated with Claude Code