Skip to content

Fold the floating panel where keyboard focus lands under it - #6815

Merged
max-sixty merged 1 commit into
mainfrom
page-ignores-panel
Nov 23, 2026
Merged

max-sixty merged 1 commit into
mainfrom
page-ignores-panel

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Where keyboard focus lands on a place the floating panel alone would hide, the panel now folds to its leaf, as . folds it. Since #6688 the page keeps no room for the panel, so an action at the foot of a workspace that fills the window, or a tab low in a stuck side list, can sit under the panel's row where no scroll brings it out. Focus there was out of sight, and Leaf's let-go rule made the next key leave the control. In a 900×500 workspace, a Tab onto a playground's Reset followed by another Tab left focus on Reset, Shift+Tab went to the slider, and Enter pressed nothing. Now the first Tab folds the panel, the next reaches Show instruction, Shift+Tab returns to Reset, and Enter presses it.

giveWay (floating-panel.js) sits beside the rule that already closes an open view for a step or travel it would stand over. It asks hiddenByCovers (geometry.js), which cuts by the same rule as seenRect, so the panel folds exactly where the let-go would otherwise fire. It asks once the script that moved focus has run, so focus passing through a place folds nothing. seenAhead and focusPlace now read the panel where its motion comes to rest, as a key pressed during a glide reads where the glide lands. Without that, a second Tab pressed during the fold's animation still let go.

To weigh:

  • The fold persists across pages, like .'s, until the user unfolds the panel or starts writing. A fold that came back once focus left would need a second way of resting.
  • A cover takes every column of a box it reaches into, so the panel also folds for a control mostly beside the row, where the let-go would otherwise have fired on a control the user sees. For the same reason, a control the folded leaf overlaps still reads as out of sight, as "Use these settings" does at that workspace's bottom-right corner, and Enter there lets go. Both need a change to that cutting rule.
  • On Me stays open over an item it lists, as travel already leaves it.

Max took this up from his session's decision page. Codex reviewed it.

Tests: the playground and side-list tests now rely on the fold rather than pressing .. The panel, walk, Tab and focus tests near the change pass, as do pnpm run test:runtime and check:browser.

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

Since the page keeps no room for the floating panel (#6688), an action at
the foot of a workspace that fills the window, or a tab low in a stuck
side list, can sit under the panel's row where no scroll brings it out.
Focus there was out of sight, and the let-go rule made the next key leave
the control: in a 900×500 workspace, Tab onto a playground's Reset, then
Tab again, left focus on Reset; Shift+Tab went to the slider; Enter
pressed nothing.

Now, where focus lands on a place the panel alone would hide once its
landing has run, the panel folds to the leaf, as `.` folds it, and stays
folded until the user unfolds it or starts writing (`giveWay`,
floating-panel.js, beside the rule that closes an open view for a step or
travel it would stand over). It reads `hiddenByCovers` (geometry.js),
which cuts by `seenRect`'s rule, so it folds where the let-go would fire.
It asks once the script that moved focus has run, of the node then
focused, so focus passing through a place folds nothing, and it counts a
label press that focuses a control under the row. On Me stays open over
an item it lists, as travel leaves it.

`seenAhead` and `focusPlace`'s stuck-box branch now read the chrome's
covers where they come to rest, as a key pressed mid-glide reads where
the glide lands: a second Tab pressed while the fold still drew the row
over Reset let go of it.

The playground and side-list tests no longer fold the panel by hand: the
first now checks that the Tab onto Reset folds it, the second that the
arrow onto the list's low tabs does.

Max took this up from the open items on his session's page. Codex
reviewed it; its findings on focus passing through a place and on label
presses are fixed here. Still open, since a cover takes every column of a
box it reaches into: the panel also folds for a control mostly beside
the row, and a control the folded leaf overlaps still reads as out of
sight.
@max-sixty
max-sixty merged commit 5208e2d into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the page-ignores-panel branch November 23, 2026 03:52
leaf-agent added a commit that referenced this pull request Nov 23, 2026
`test_every_part_of_a_floating_box_moves_one_way_per_input` served one
page for all of its Hypothesis examples. The page's server keeps each
field's words as a draft, so after a `comment` example ran, every later
page reopened that comment box with focus in it. The box stands beside
`LOW_PASSAGE_PAGE`'s low passage, under the floating panel's row. Since
#6815, focus landing on a place only the panel hides folds the panel to
its leaf (`giveWay` in `browser/runtime/floating-panel.js`), so the next
`panel` example found `.lf-fp-field` folded away (`display: none`) and
timed out pressing it. Each example now serves its own page, so no
example inherits another's drafts. That makes the shared-draft comment
unnecessary, so this removes it.

The runtime is unchanged. Folding the panel there is what #6815 set out
to do, and the test's other case, which serves its own page, still opens
the panel's field. Locally the property test failed in Chromium on the
`panel` example (`gap=0, draft='', edits=[('Shift+Enter',)]`) after 258
s. With this change it passes in both `[browser]` and
`[firefox_browser]` in 95 s together.

<details><summary>Reproduction</summary>

A probe on one served page ran a `comment` example with a draft, then
opened a new page. That page loaded with the comment box's field focused
and the panel at `data-lf-rest="mark"`. Its field measured 0×0 with
`display: none`. A `panel` example on the same server timed out on the
click, as in [run
45159811021](https://github.com/max-sixty/leaf/actions/runs/45159811021).

</details>

Closes #6869 — automated triage

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 23, 2026
Since #6815 the floating panel folds itself to the leaf when keyboard
focus lands somewhere only its row would hide (`giveWay` in
`floating-panel.js`). In `thread-panel-gallery`, a thread view's **Show
on page** lands focus in such a place, so the panel folds. The press
sweep in `tests/journeys/test_pressed_controls.py` then gets back to
Threads through `on_tab`, which presses the leaf once and expects the On
view to open. On a folded panel that press only unfolds the row, so the
Threads tab never appeared and the click timed out.

`on_tab` now unfolds a folded panel before anything else. The unfold
step is a new `unfold` helper in `dev/leaf_dev/browser.py`, which
`open_menu` and `page_comment` had each written out inline. The fold is
what #6815 meant to do, so no product behavior changes.

**Verification:** the `[thread-panel-gallery]` case failed on every
local run on `main` (`1bf92095f`). `git bisect run` over
`d53e9994f..c8ab9ec` points to #6815 (`5208e2d88`). With this change
the case passes, and so do the `[catch-up]` and `[alert-review]` cases
and `test_on_me_claims_nothing_before_the_first_replay`, which uses
`page_comment`.

Closes #6870 — automated triage

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