Skip to content

Comment on selected words from the panel's field - #3275

Merged
max-sixty merged 5 commits into
mainfrom
field-comments-on-selection
Oct 20, 2026
Merged

max-sixty merged 5 commits into
mainfrom
field-comments-on-selection

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Words a finger selects, or a selection a script or browser command makes where no field opens beside it, put a worded "Comment on selection" step in the floating panel's row, in place of the On me and Threads counts and ahead of a stance's own steps. The user reviewed why the row holds these buttons and accepted moving the offer into the panel's page field: with words selected, its placeholder quotes them and a press on it opens the comment on them.

The offer. composing/surface.js stays its one owner: it keeps the anchor read when the selection last settled and hands it to the panel through pageComment.offer(...). The comment-selection page control and its rank are gone, and with them the gesture-rank arbitration in page-controls.js.

The field (floating-panel.js). While words are offered, the placeholder quotes them (the field's ellipsis cuts a long quote to its room), its accessible name says "Comment on the selection", and where a page draft hides the placeholder, the line over the field quotes them. A press addresses the words only while the field shows them: an error the field says instead keeps the press on the page. The press's mousedown is cancelled, so the editor never takes focus; the press comments on the selection as it stands, falling back to the anchor read at settle where the selection is gone (a tap on iOS may drop it). A Tab into the field still writes on the page. On a page that draws its own annotations, the field stands in an open comment box's place while it offers words (data-offers), and the box comes back with its draft when they go. Letting go of the words restores the ordinary placeholder. The desktop path, the field beside words a mouse selects, is unchanged.

The cost the user accepted: while words stand selected, a press on the field always addresses them.

Tests. Every test that pressed the step goes through a selection_field(page) helper in tests/render_harness.py. test_the_panel_field_offers_selected_words_to_a_press_alone covers a Tab writing on the page, the line over a draft quoting the words, and the field standing in an open box's place on an annotated page (it fails with the stylesheet change reverted). The phone journey checks the quote, the ✕ and the row's width in Design mode at 320px. The dev drivers (stills, record-demo, eval user), docs/how-it-works.html and the feature gallery follow.

Checked: 26 focused tests one at a time, pnpm run test:runtime, pnpm run check:browser; probes in touch Chromium at 320px, desktop Chromium and Firefox. Not checked: real iOS Safari, and Firefox under touch emulation, which hangs in the probe.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 4 commits October 19, 2026 23:12
Words a finger selects, or a selection a script or browser command makes where no
field opens beside it, used to put a worded "Comment on selection" step in the
panel's row in place of the On me and Threads counts. That step outranked a stance's
own steps, so selecting words in Draw mode or during a search took them off the row,
and it was one more control to find.

Now the panel's page field offers the selection itself: its placeholder quotes the
words (cut by the field's ellipsis to its room, so a 320px row shows the opening of
the quote), its accessible name becomes "Comment on the selection", and a tap or
click on it opens the comment on that passage. The counts and a stance's steps and ✕
stay on the row, and letting go of the words brings back the field's ordinary
placeholder. Where a page draft hides the placeholder, the line over the field quotes
the words instead.

The anchor is the one read when the selection last settled, captured at the press's
pointerdown and used at its click: the field taking focus drops the page's selection
on iOS, and the press's own mousedown puts away any comment box it finds open. A Tab
into the field, or the runtime placing the caret there, still writes on the page.
The cost the user accepted: while words stand selected, a press on the field always
addresses them. The desktop path, the response field beside words a mouse selects,
is unchanged.

The comment-selection page control and its rank go; the gesture-row machinery stays
for search's and Draw mode's steps. Tests, the dev drivers (stills, record-demo,
eval user), the how-it-works page and the feature gallery move to the field.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review fixes to the panel field that comments on selected words:

- On a page that draws its own annotations, an open comment box stands in the
  field's place, so new words a finger selected were offered in a hidden editor and
  had no visible route. While the field quotes selected words, it now stands in the
  box's place (`data-offers` on the panel), and the box comes back with its draft once
  the words go.
- A press on the field addresses the words only while the field quotes them, so an
  error the field says instead hides the words and the press writes on the page.
- The press's mousedown is cancelled when it will address the words, so the editor
  never takes focus: no "Comment on the page" placeholder while a mouse button is
  held, no keyboard raised on a phone before the comment takes focus.
- With the editor no longer taking focus, the page's selection still stands when the
  press ends, so the press now comments on that selection as it stands, falling back
  to the anchor read when it last settled only where it is gone (as a tap on iOS may
  leave it). A data update that re-renders the selected words while keeping their
  native endpoints sends no selectionchange, so the settled anchor alone went stale
  there and the comment box refused focus (test_call_diff_projects_stable_commentable_rows).
- The field's accessible name follows the same reading as its placeholder, so a Tab
  or programmatic focus names it "Comment on the page", in the repaint frame where
  the placeholder changes too.
- With the comment-selection row gone, page-controls.js no longer arbitrates between
  gesture ranks: every gesture row comes from the innermost scope at one rank.

A new browser test covers a Tab into the field writing on the page, the line over a
page draft quoting the words, and the field standing in an open box's place on an
annotated page (which fails with the stylesheet change reverted).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/floating-panel.js
#	skills/leaf/assets/runtime/page-controls.js
#	skills/leaf/kernel/kernel.json
#	tests/journeys/test_render_semantic_selection.py
leaf-agent
leaf-agent previously approved these changes Oct 20, 2026
# Conflicts:
#	skills/leaf/assets/runtime/floating-panel.js
#	skills/leaf/assets/runtime/page-controls.js
#	skills/leaf/kernel/kernel.json
#	skills/leaf/kernel/leaf.js
#	skills/leaf/kernel/runtime/bundle-document-identity.js
#	tests/journeys/test_render_semantic_selection.py
@max-sixty
max-sixty merged commit 0524e6f into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the field-comments-on-selection branch October 20, 2026 08:09
max-sixty added a commit that referenced this pull request Oct 20, 2026
…s route (#3290)

The review of why the floating panel's row holds gesture buttons ended
in five proposals the user accepted, each giving a finger its route on
what the gesture acts on: search walks from arrows in its box (#3251),
the duplicate Undo stroke, Done and Select steps go and a press on the
marked match selects it (#3267), lifting a capture's drag attaches it
(#3262), and the page's field quotes and comments on selected words
(#3275), beside the one ✕ a stance offers (#3233). With those landed, no
page scope row stands in the row as a worded step, and the review's last
proposal was the rule that keeps it so.

**The rule.** A page scope's rows take no words. Each row of a page
scope that runs a press is its stance's `exit`, which the panel's ✕
runs, or declares `touch: false`; `register.js` refuses a row that is
neither, as it already refuses a page command without `touch`. So a new
gesture meets "what does a finger press?" where it is declared, rather
than gaining a worded button by construction. `keyboard/AGENTS.md`
("Touch routes") states it, and `bindings.js`'s contract for `touch`
follows.

**Deleted.** The steps half of `touchPresses` in `register.js` and
`touch-controls.js`; route-level `touch` words and their check in
`bindings.js`; gesture rows and their rank in `page-controls.js` (the
✕'s rank is now `exit`); the panel's step branch and the `.lf-fp-step`
face, with the typing rule's exception for it.

**Declared.** Thirty scope rows gain `touch: false`, across the thread
landing, the command reference, the standing scope, the margin, the
response bar and reactions, the composer, the target picker's hints,
Go-to, and area capture's arrows. Each is reached by a tap on what it
acts on or the surface's own control.

**Tests.**
`test_a_mode_entered_from_the_panel_offers_its_way_out_in_the_row` still
expected Draw mode's counts to give way to a step, which #3267 had
ended; it now expects them to stay. Assertions on the gone `.lf-fp-step`
class are dropped, and the stale step prose in tests and runtime
comments is rewritten.

Checked: `pnpm run test:runtime`, `pnpm run check:browser`, probes of
the feature gallery and review-a-plan (no register refusal), and the
tests that drive each stance, the ✕, the field's offer and area capture.
`test_reactions_keep_all_six_buttons_on_an_occupied_target[390-keyboard]`
fails, and fails the same on `main`.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
…s follow-up (#3340)

Removes TODO's "Unconfirmed: scrolling a live sample sometimes sticks"
after running the check it asked for, and brings the floating panel's
goal note and TODO #28 up to date with #3275.

**Live samples.** `leaf-dev probe` measured every framed sample on
feature-gallery, thread-panel-gallery, diff-thread-gallery,
docs/threads.html and docs/event-log.html, in Chromium and Firefox, at
1440x900 and at phone width (Chromium under touch, Firefox at 390x844).
Each block sample's frame is its page's height plus the 2px border
(scrollHeight equals clientHeight inside), and a wheel or touch scroll
over it moves the outer page by the full step. Playwright's Firefox lost
track of the gallery's later frames, which a screenshot shows drawn, so
Firefox covers 13 samples.

A window sample keeps its fixed height by design. One,
`bg-thread-api-sample`, holds a page taller than its window (848px in
673px), so a wheel scrolls it first and then the outer page. Chromium
moved on at the next step. Firefox kept sending the wheel to the frame
for about 1.5 s after the sample's page last scrolled, so a continuous
wheel stops there until the user pauses. It does the same over a plain
`overflow: auto` box with no frame and no sample, so this is Firefox's
own wheel handling rather than anything Leaf does.

**Floating panel.** The note's one follow-up, comments on selected words
going through the anchored comment box rather than the panel's field, is
settled by #3275: where no box opens beside the words, the field quotes
them and a press opens the box on them. TODO #28 now says its list is
empty and that it waits on the user's review of the desktop design.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants