Skip to content

fix: end panel writing state before closing a view - #4760

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-4745
Oct 30, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-4745

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Closing a panel view now ends its writing session before the close transition renders. Previously, the row could lose Close while still carrying the writing state from the field, hide its quick control, then show it again when focus left the panel in the same gesture. This also affected closing Threads after leaving its comment field.

Restore the Escape-close step in the panel ask-location test. It reproduces unchanged write: hidden on div.lf-fp-quick before the fix and passes afterward. Draft storage and the draft's layout posture remain separate from the writing session.

Validation: focused browser checks cover the restored close, comment/reply lifecycle, Escape order, draft layout, Resume writing and refused comments; the runtime suite and browser type/build check also pass.

Closes #4745 — automated triage

Closing a view ends its writing session before rendering the page row, so the quick control no longer hides and reappears in the same gesture. Restore the Escape-close regression coverage while retaining reply focus, ask rings and digit shortcuts.

Closes #4745
@leaf-agent
leaf-agent merged commit 4bda5fe into main Oct 30, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-4745 branch October 30, 2026 09:30
max-sixty added a commit that referenced this pull request Nov 16, 2026
Pressing a row in the leaf's menu puts the menu away, which paints the
empty row, and then runs the row's command, which may paint again. When
`z` shows a resolved thread in the panel, the first paint showed the On
Me mark and the second hid it, in one task, so the write watch failed
`test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab` on every
main and nightly run. With a page draft in the field, `data-lf-drafted`
flipped the same way.

`putAwayThen` now holds the row's posture while the press runs: the
parts of the row that follow the field and the view over it (the host's
writing, draft, offer and press attributes, the leaf's dots and count,
and the quick seat). It then paints once, so each is written once per
press. The Fold row's bypass from #5263, which avoided the same paint
flipping the leaf's error dot, is removed, and Fold goes through
`putAwayThen` like every other row.

**Why not one transition, as the issue proposed.** I tried deferring the
put-away's paint into the command's own transition. The command then ran
with the menu still drawn: Align from the menu on touch left the page
unscrolled
(`test_the_menu_keeps_its_place_when_a_revision_shortens_the_words_it_held`),
and two other menu tests gained new unchanged-write findings. Commands
need the panel the put-away drew, so only the posture waits. #4760 and
#5335 fixed a different cause, a focus move after a paint changing the
writing posture, and those fixes stand.

**What it leaves.** The hold ends when the command returns. A view a
command opens after an `await`, as Undo does for a resolved thread
anchored below the fold, still repaints the posture, as on main; the
watch doesn't report that case, since the two writes reach it in
separate batches. Pressing Search page from the menu's search still
hides and re-shows the field's editors, search surface and mode chip in
one press, on main as here: the field's occupant goes search, page
editor, search, and the command needs that search drawn, so the hold
leaves it.

**Checks.** `leaf-dev probe --base`, sampling each frame for 800 ms
after pressing Undo, Undo over a page draft, Fold with an error pending,
and Copy link, shows the same frames on base and head; base writes the
quick seat's `hidden` twice in the Undo press and `data-lf-drafted`
twice in the draft case, head neither. The failing test, the Fold test
(which fails with the old `putAwayThen` and no bypass) and 29 other
focused tests on `putAwayThen`'s callers pass, as does `pnpm run check`.

Closes #4745

> _This was written by Claude Code on behalf of max-sixty_
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.

Closing a panel thread briefly toggles its quick control visibility

1 participant