Repository navigation
Keep comment responses anchored - #395
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Two things I could reproduce against bb3fc3a, both on the path this PR is about — keeping the field usable while the choices stand open.
Digits typed into the open field post reactions. RESPONSE_OPTIONS is placed above ELEMENTS in pageScopes(), so its rows are consulted before the text box's own TYPING claim, and response.reaction.choose is the one row in it with no focus gate (response.move and response.activate both gate on focusedResponseOption()). With the group open and focus back in the field — which this PR's own test asserts is a normal state — typing Cut 3 lines drops the 3 from the draft and posts a reaction event instead. That is a durable log entry the reader never asked for, from a keystroke they meant as text. dispatch.js states the rule for the sibling case: focus entering a box disarms REACT, "a digit typed in a box is text". Inline suggestion below.
Narrowing the viewport while the group is open dismisses the whole bar. fabFixedLeft is held through the ResizeObserver pass and placeFab derives room from it, so once the viewport's right edge moves left of the held edge, room <= 0, placeFab reports failed placement, and refreshFab takes the showFab(null, …) branch — field and choices both go. With the group closed the same resize re-places the bar normally, so the hold is what turns a reflow into a dismissal. Rotating a phone or dragging a window narrower mid-response is the ordinary way in.
How I reproduced both
Both run against the PR's merged tree, PANEL_PAGE, with the harness helpers from tests/test_render_reactions.py.
Digits — after c, Tab, Shift+Tab (field focused, group open), page.keyboard.type("3 lines"):
FIELD VALUE: 'Cut lines'
EVENTS: ['note', 'comment']
TOKENS: [None, 'clarify']
Resize — at 1280 select, c, fill, Tab (group open), then resized(page, 500, 900):
BAR BEFORE: {'x': 742, 'y': 319.3, 'width': 502, 'height': 32}
BAR VISIBLE AFTER RESIZE: False
The same script without the Tab (group closed) keeps the bar and re-places it at x: 220.
leaf-agent
left a comment
There was a problem hiding this comment.
Two things on 23dd24c5, both about the case it names — a frame taking the keyboard while the reader is standing somewhere. The two earlier threads are unchanged by this commit and still stand as posted.
The restore samples focus at its checkpoints, but the steal that actually happens lands during an await, so the sample can be seconds old: measured on the merged tree, a reader standing on #bg-core-surfaces at 4.70s lost it when the open-threads frame took the keyboard at 5.23s, and the restore focused body — the destination captured before the reader moved — rather than the section. And the new assertion states no ordering against the boot it names: at the point it reads, neither frame carries data-interaction-ready yet. Both inline.
How I measured
Both runs are against this PR's merged tree, on FEATURE_GALLERY, with the harness helpers from tests/test_render_navigation.py. I wrapped HTMLElement.prototype.focus in an init_script to record every call with its argument, the outer activeElement before it, and where focus landed, plus focusin/focusout on the document.
Stale destination — after load I focused a section the way focusDestination does (tabIndex = -1, focus, remove on blur), then waited out the gallery boot:
STAND: {'focused': True, 'id': 'bg-core-surfaces'}
{"t": 4696, "call": "section#bg-core-surfaces", "from": "body", "landed": "section#bg-core-surfaces"}
{"t": 5234, "out": "section#bg-core-surfaces"}
{"t": 5236, "call": "body", "from": "FRAME:open-threads", "landed": "body"}
FINAL: {'tag': 'body', 'frame': False}
The restore ran with the frame holding the keyboard and chose body, so outerFocus had not been refreshed since before 4.70s — no checkpoint ran between the reader's move and the steal.
Ordering — replaying this test's own opening steps (resized, the sign-off click, round_trip) and reading the clock where the new assertion sits:
AT ASSERTION: {'t': 5807, 'frame': False, 'ready': [False, False]}
LOG: [... {"t": 5234, "out": "body"}, {"t": 5239, "in": "body"}, {"t": 5321, "out": "body"}, {"t": 5323, "in": "body"}]
# second run
AT ASSERTION t: 6191
BOTH READY t: 6355
leaf-agent
left a comment
There was a problem hiding this comment.
0e10a353 closes both earlier threads on their own terms — resolving them. The release is keyed on rightEdge(), and the bar is position: absolute, so neither the expansion nor syncResponseOptions moves body's box: the lock survives the expansion's own layout pass and only a body-width change trips it, which is the distinction the new comment claims.
One thing from outside this commit. #383 is open against the same file and the same problem as the remaining gallery thread here. Its keepsReaderStanding wraps every call into the frame API and restores through focusDestination, so it samples the outer destination at the call rather than at checkpoints — that is what the thread on interaction-gallery.js is asking for, and going through focusDestination also covers the temporary-tabindex case the raw .focus() here misses. Both PRs rewrite Demo.load(), so they will conflict; worth deciding which of the two owns that policy rather than landing both.
leaf-agent
left a comment
There was a problem hiding this comment.
5074b5a0 landed while I was reading 196795b6, so this is against the inert version. It is the better fix by a distance: the frame declares itself not a place to stand instead of the outer page policing focus after the fact, and it drops the sampling the earlier thread was about rather than refining it — resolving both threads.
Measured on this PR's merged tree, FEATURE_GALLERY at #bg-interactions: both frame bodies carry inert, the outer focusin log for the whole boot is ['BODY'] with no frame entry, and a reader standing on a shadow-DOM button through the 5s delayed contained state read still holds it when both frames report ready.
One thing, inline: the delta takes both assertions with it, so nothing in the suite now says a booting frame must not hold the page keyboard.
…t-more # Conflicts: # skills/leaf/assets/runtime/interaction-gallery.js
## Summary - keep the anchored Comment field mounted while More reveals Suggest and the declared reactions - preserve the field's draft, focus path, and horizontal position while actions expand inline or wrap below, then re-anchor safely if the viewport changes - keep item and message reaction surfaces independent, with keyboard access for the local response group and native digit entry in its field ## Testing - `uv run pytest tests` (907 passed) - `uv run pre-commit run --all-files` - `./bin/leaf version check .tmp/previews/review --render` - focused browser journeys at 390px and 1280px, including field digit entry and a live resize to 500px, plus a composed light/dark UI sweep > _This was written by Codex on behalf of max-sixty_
Two conflicts, both import lists, and one thing worth recording. `composing/selection.js`: main's #395 added `keeps`; this branch had extended the module's docstring for the kept-draft address. Both. `keyboard/page.js`: main's #388 added five response-option imports and kept `pendingDrawing`; this branch had replaced `pendingDrawing` with `composerHolds`, the single reading of whether the box holds anything a reader would miss. The union, less `pendingDrawing`, which no longer has a use in the file. Main's #399 ("Report a ring cover from a neighbour that left its holder's flow") lands in the same ring reading this branch changed, and the two compose rather than duplicate: theirs answers a neighbour out of its holder's flow, this one answers a control painting in front of the box reported over its ring. Both excuse only what they demonstrate. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Summary
Testing
uv run pytest tests(907 passed)uv run pre-commit run --all-files./bin/leaf version check .tmp/previews/review --render