Skip to content

Put every surface away by one press away - #3756

Merged
max-sixty merged 7 commits into
mainfrom
one-outside-press
Oct 23, 2026
Merged

max-sixty merged 7 commits into
mainfrom
one-outside-press

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Six surfaces go away on a press elsewhere, and five of them judged that press differently. The floating panel, an offered reaction remove and a margin pin's unfolded actions each listened to the document's pointerdown, so they went as a press began, wherever it ended; the response bar listened to mousedown, a compatibility event a touch delivers only after it lifts, and the modifier aim called the bar's standDown itself because its claim stops that event; a reply's composition listened to click, which a drag delivers to the common ancestor of where it began and ended. Only the margin card judged both ends of the press. So a drag that began on the page and ended in the panel put the panel away, a press that began on the page and ended on a reaction's Remove took the offer back under the pointer, a drag out of a reply box ended its composition, and a finger and a mouse were different routes per surface.

onPressAway(away, dismiss) in browser/runtime/focus.js is now the one mechanism. It is the margin card's rule, generalized: a surface goes when a primary press begins outside it and completes outside it (away(path) read at its pointerdown and its pointerup), which is how the platform judges a popover's or a dialog's closedby light dismissal. A press the browser cancels, such as a touch scroll, and a secondary press, whose context menu ends it before or after its release depending on the platform, put nothing away. It is built on onPress, which now returns an unsubscribe so anchor-controls.js can stop listening when it is torn down.

All six surfaces use it, and their own listeners are gone:

  • the floating panel's view and menu (floating-panel.js);
  • the response bar and composer (composing/surface.js): standDown keeps only what it puts away, and pressedAway holds what counts as inside, now including a capture's drag beside a draw stroke, since both go on into the draft the composer holds. The aim's explicit call, and its plumbing through browser/leaf.js, go: onPress listens on the window ahead of the aim's claim, so a claimed press is heard like any other;
  • an offered reaction remove (anchor-controls.js);
  • the margin card and a pin's unfolded actions (margin-projection.js);
  • a reply's composition (thread/replies.js), which keeps the composition the press began in, and no longer needs its guard against keyboard activation, since a key's click is no press.

Each surface still decides whether a press a pointer mode claims is one away from it: the composer stays through a stroke or a capture, while the margin card goes, as its comment records.

standDown's branch that closed the command reference is deleted rather than moved. It could not run: standDown returned under any native modal, and the reference opens as a modal dialog (showNativeLayer), whose closedby="any" is the platform's light dismiss for it; closeCommandReference and commandReferenceOpen lose the export only that branch read. None of the six surfaces is a popover or dialog, so the platform's light dismiss covers none of them; making them top-layer surfaces would change their focus, stacking and inertness and is not part of this change.

What changes for the user: each surface goes as the press completes, not as it begins; a drag that ends inside a surface, or begins in it, leaves it standing; a finger scrolling the page on a phone no longer closes an open view, an offered remove or a pin's actions; and a right-click no longer puts anything away. A press on the page still moves focus at its mousedown, so a pin's unfolded actions still fold when a press on the page takes focus out of them, as leaving them by any route does.

tests/browser/controls/test_press_away.py holds each surface to the press: a drag between it and the page leaves it standing, a touch tap away and a mouse click away put it away, a touch swipe on the page leaves the panel open, and Escape, its keyboard route, puts it away. The panel, reaction and reply cases of a drag fail on main and pass here. The touch press is dispatched through CDP's Input.dispatchTouchEvent, so a fine-pointer page hears a touch-type press without the coarse pointer that would route selected words to the panel's field instead of the bar; the pin's case runs in a phone context. Also run: pnpm run test:runtime, and 33 existing browser tests that press away from these surfaces (the aim and design-mode presses, reactions, anchors' drag selection, margin pins and cards, reply sessions, the panel's row and page search).

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

leaf-agent
leaf-agent previously approved these changes Oct 23, 2026
@max-sixty
max-sixty merged commit 1e38701 into main Oct 23, 2026
3 checks passed
@max-sixty
max-sixty deleted the one-outside-press branch October 23, 2026 13:42
leaf-agent added a commit that referenced this pull request Oct 23, 2026
[Main CI run
39966571674](https://github.com/max-sixty/leaf/actions/runs/39966571674)
exposed two press-handling failures after #3756 unified surface
dismissal. A synthetic release outside the document sent `window` to the
response surface's visual lookup and threw; once that was guarded, the
label test showed that closing an already empty response bar repainted
temporary native focus as the keyboard location. A target-picker double
click also lost the Comment field's delayed focus: its second claimed
press advanced the input generation after the first chose the target.

Read visuals only for element targets, close the response bar only when
it has an anchor, and renew the Comment handoff for a claimed
multi-click continuation. The picker still claims the page's link rather
than following it.

Both failed cases passed on the final build of this branch. Two nearby
press-away cases passed, `pnpm run build:browser` passed with the
generated kernel committed, and `pnpm run test:runtime` passed all 534
tests. The third failure in the run is a separate quote assertion
repaired in #3766.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3756 moved the response bar's stand-down from `mousedown` to the
completion of a press away (`onPressAway`), after the press's own focus
change, but kept `letGoOfFab`'s landing, which reads focus as it stood
before the press. A click on a focusable item (here, the button the bar's
comment was about) therefore focused the item and then had the bar let go
of it onto the reading block and blur, leaving focus on the body. `e`
then had no focused item to react to, so
test_offline_reaction_waits_for_its_saved_state posted nothing instead of
undoing the saved reaction. The bar now lets go only of a user still in it;
anyone the press placed elsewhere stays there, as before #3756.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3939)

Adds a nightly macOS run of every test tier, and fixes every test that
failed in its first run or in the Linux nightly beside it: 89 tests in
[run
40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
60 of them only on macOS.

## The macOS nightly

`ci.yaml` gains a `test-macos` job: every tier on `macos-15`, `-n 2` on
its three cores, in the daily schedule and a dispatch. It belongs to
`ci`, so a failure turns that run red and reaches tend through the
existing `workflow_run` trigger, with no tend configuration change.
GitHub doesn't bill hosted runners for public repositories; the job
holds one of the account's macOS slots for about three hours. The test
step names `shell: bash`, without which a step runs without `pipefail`
and piping pytest through `tee` reported the first run's failures as a
green job. The setup action's Ubuntu mirror step now runs only on Linux.

`tests/AGENTS.md` counts `test-macos` among what tend repairs and leaves
only failures no CI run shows to local sessions. It drops the
instruction to confirm a macOS-only failure at normal priority because
`taskpolicy -b` slows headless Chrome: a test that fails on a slower
host depends on timing, and the fix is to the test. `running-tend` tells
the session fixing a red run, which has only a Linux runner, to verify a
macOS-only fix by dispatching `ci` on its branch.

## The fixes, by cause

Product fixes:

- A drafted margin card rose against the window's foot and never came
back as the draft shrank (#3524). It now holds the top it opened at and
drops back.
- A tapped pin reseated 11px lower as it unfolded, because the
hold-to-read toggle was pressed before the browser focused it (#3341).
- A page's first thread card could cover its passage, because the
placement that makes room was dropped while Floating UI loaded (since
#1526).
- A heading's "Copy link to section" stayed at the heading's far end
after the window narrowed and widened, since every engine keeps its last
`position-try` fallback (#3836). It now picks its place from the current
width.
- Putting the response bar away moved focus off the button the press had
just focused, so the next `e` found nothing (#3756).
- A trace's image-tools status shared a class with the image's loading
notice, whose rules hid it (#3707).
- WebKit scrolled the outer page 1,386px when a sample editor took focus
(#3634).
- In draw mode a press left the previous press's release timer pending,
so a fast second click reached the page.
- Hint refreshes read the geometry of every target inside a closed
disclosure, forcing layout of skipped content.
- A sidebar page's sticky track clipped focus rings (#3918). A stuck
track body now keeps the ring's room inside its edges, so its blocks
stand 5px in from each side.
- Tab revealed a block's Copy flush with its scroller, cutting its ring
(#3916).
- The hidden "my change" word inside a choose group took a cell's
padding and read as clipped content (exposed by #3837's check).
- Visual review case buttons kept their wide padding after the first
breakpoint crossing, a Chromium restyle bug avoided by making the case
list a plain container.
- A held shot's scrolling stage didn't declare that it holds its height
(#3703/#3704).
- When the log refused a reply, the floating panel's head moved down
69px and the restored draft pushed its controls up 21px (#3400). Through
a refusal the panel now holds its head and the field its height, on the
holds a press already takes; the refused turn's room goes at the user's
next turn.
- A reply box's ↑ (edit your last message) appeared only after an
unrelated repaint once its last message became editable (#3855). Every
message draw, by any thread reader, now recomputes that row's keys.
- A trace's images took the page's scroll anchor, so a lane change in
the timeline scrolled the page 62px under an arrow key; they no longer
anchor scroll. The trace overview wrote its window's new start before
reading its size, so for one layout the window ran past its strip and
Chromium scrolled the page up to 838px; it now reads before it writes.
The image tools' status keeps its line when its text clears.
- Web Awesome's radio group moves focus on an arrow with a bare
`focus()`, which Leaf's ring scroll margin turned into a page scroll.
The vendored bundle is patched (`build/vendor.mjs`) so both calls pass
`preventScroll`.
- A Leaf page inside an iframe took focus from the page around it when
it finished arriving. Its arrival recovery now runs only at top level or
in a frame that holds focus.
- The margin rail's one Tab stop stayed on whichever row last held it,
so a resize could leave it below a row the user sees first. It is now
the highest row in view; a focused row keeps it.
- A resize that moved a sidebar page's track into the page, with neither
place made by the reader, took the track's place over the page's:
live-progress jumped 1861px (#3918). On a tie the page's own place wins.
- The whole-page rule read a shut disclosure whose children are all
generated as showing what it holds (#3908); it now skips only `.lf-ui`
apparatus.
- The gallery revealed its stamped frame at the centre, carrying the
pressed button 45px; it now scrolls only as far as needed.

Test fixes:

- The Codex fixture copies the running interpreter as `codex`; on a
framework Python, as on the runner, the copy fails its code signature
and macOS kills it at launch. That broke 39 tests. The copy is now
re-signed ad hoc, and the fixture no longer leaks `PYTHONHOME` into the
command it runs.
- The plain-HTTP copy test missed Chromium's lower-cased host; the
event-door refusal test read its answer after the server's reset; the
stale-keys sweep raced the browser entering fullscreen; the words watch
didn't credit a blur from a press elsewhere.
- Several tests read state before it settled (a shown gesture's arm, a
side list's smooth scroll, a sample's focus returning, a held reply's
menu), and now wait for it. Assertions predating #3830, #3916, #3670,
#3673 and #3217 now read the current behavior.
- Three waits fixed their own deadline instead of the suite's, among
them the async-probe test's 500ms.
- The command hub's record now sticks in view, so the Atlas journey
opens its news before reading each row; the region-capture journey drags
over the unreadable image it means to fail on (#3861 draws only the
element that alone paints the crop).
- The touch-capture removal test, which fails intermittently on main,
now reads the shelf right after the tap and names the elements the tap
reached, so its next failure says whether the tap missed or the image
came back.
- The feature-gallery scroll pass allows a third of its steps to write
the contents' `aria-current`, as gestures already do, since the count
depends on where sections fall under the platform's fonts.

The branch also merges the four open `grind/f-main-tests-*` pull
requests, whose fixes cover five more of the run's tests: #3871, #3882,
#3887 and #3906. This pull request lands them.

Each fix was reproduced failing and then passing by node id, on this Mac
or, for a Linux- or runner-only failure, against a run's log, except
where its commit says otherwise. Dispatched full runs on this branch
([40156291557](https://github.com/max-sixty/leaf/actions/runs/40156291557),
[40186545420](https://github.com/max-sixty/leaf/actions/runs/40186545420),
[40196342887](https://github.com/max-sixty/leaf/actions/runs/40196342887))
check both platforms; the second took the macOS job from 86 failures to
38, most of the rest fixed since. A few macOS-only failures pass on
every local attempt (two reading-place tests, a scroll repaint, Back
from a thread, opening a line under the last, the Android composer's
Return, margin-entry order, a card paging on, a turn arriving out of
view) and have no fix here; once this lands, the macOS nightly reports
them to tend.

> _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