Skip to content

Attach an area capture when the drag lifts - #3262

Merged
max-sixty merged 2 commits into
mainfrom
capture-attach-on-lift
Oct 20, 2026
Merged

max-sixty merged 2 commits into
mainfrom
capture-attach-on-lift

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Area capture drew the area with a pointer and then needed a press on "Attach capture", a worded step the floating panel's row showed while capture stood. The user reviewed why the row holds these buttons and accepted making the drag the whole gesture: lifting it attaches the area, and the attachment's ✕ in the composer takes back a bad one, as a drawing's does.

The change is in composing/region-selector.js. The Attach row keeps Enter and declares touch: false, so while capture stands the panel's row holds only the ✕. A press that travels under 8px on both axes is a tap: it, and a cancelled pointer, attach nothing, put back the area that stood before the press, and leave capture open to drag again. A capture that fails to rasterize stays open over the same area, for a fresh drag or Enter. The module header records the decision and its cost: a pointer can no longer adjust the area before it attaches, only redo it.

Tests. The drag-then-press cases in tests/browser/threads/test_media.py and tests/journeys/test_render_threads.py attach on lift. The touch case is now test_touch_capture_attaches_on_lift_and_a_tap_or_cancel_attaches_nothing; new cases cover the keyboard route (test_the_keyboard_moves_resizes_and_attaches_the_area) and a failed capture followed by a second drag (test_a_capture_that_fails_to_draw_stands_for_another_drag). open_capture_area waits for the area to be drawn, which made the tap case reliable. With the old region-selector.js swapped back in, 8 of the 12 capture tests fail. The feature gallery's steps, the corpus and the stills' capture state follow.

Checked: the 12 capture tests, pnpm run test:runtime, pnpm run check:browser, and a Firefox probe with a mouse (a click keeps the area and capture open, a drag attaches on release, the ✕ removes the attachment).

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

max-sixty and others added 2 commits October 19, 2026 23:08
A pointer used to draw the area and then press "Attach capture", a step the
floating panel's row showed while capture stood. Now lifting the drag attaches
the area, so the drag is the whole gesture; the attachment's ✕ in the composer
takes back a bad one, as a drawing's does. The Attach row keeps Enter for the
keyboard and declares `touch: false`, so the panel's row offers only the ✕.

A press that travels under 8px on both axes is a tap, not a drag: it, and a
cancelled pointer, attach nothing and put back the area that stood before the
press, with capture still open to drag again. Before, a tap left an 8px area.
A pointer can no longer adjust the area before it attaches, only redo it, and a
capture that fails to rasterize stays open for a fresh drag (or Enter), where a
pointer used to press Attach again.

Tests: the drag-then-press cases now attach on lift; the touch case covers a
tap, the ✕, and removing the attachment; new cases cover the keyboard route and
a failed capture followed by a second drag. The feature gallery's steps and the
corpus say the new gesture, and the stills' capture state holds its drag.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 154bac6 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the capture-attach-on-lift branch October 20, 2026 06:25
max-sixty added a commit that referenced this pull request Oct 20, 2026
The any-key lift added a raw keydown listener in composing/input.js, a key
path behind the register's back (test_the_register_is_the_only_way_a_key_
enters_the_runtime). It is gone. A covered box now lifts its cover from what
already reports the key:

- a send key reaches the box's own send binding (`text.send`), whose
  `pressed` lifts the cover and sends nothing, as Send reached by the keyboard
  already did, so the ? reference gains no row;
- an edit arrives as `lf-before-edit`, as before;
- a caret move arrives as `lf-caret-move`, which the text field now fires for
  a user selection change that edits nothing (CodeMirror's `select` user
  event); a write to the selection triple fires nothing.

A modifier alone, Tab and Escape neither edit nor move the caret, so none of
them lifts the cover.

The capture test attaches on the drag's lift: main removed Attach capture
(#3262), which is why it timed out waiting for that button. The panel's error
test also checks that a caret key lifts the cover and moves the caret.

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 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]>
leaf-agent added a commit that referenced this pull request Oct 22, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/39770356884) failed
the touch area capture case after the image appeared: the attachment
remained after the removal tap. The case freezes Playwright's browser
clock to check that the next press begins before queued drag work. It
previously read the tap's result while that clock was still frozen. This
change resumes the clock immediately after the tap, preserving the
gesture ordering check while allowing native activation to finish before
the removal assertion.

The focused case passed on the current branch. It also passed eight
times before this change, so the CI failure is intermittent and the
focused pass alone does not prove the failure is gone. The change is
confined to the test's timing; the attachment behavior and runtime are
unchanged.

The test came from #3262, which made lifting the area drag attach the
image and kept the composer's × as its undo route.

Co-authored-by: leaf-agent <[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