Skip to content

Hold drag state in widget-elements.js, and give focus.js the one hand-back and Tab-stop reading - #1247

Merged
max-sixty merged 2 commits into
mainfrom
agent-a01c9cd000f506949
Sep 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a01c9cd000f506949

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two consolidations from the concept survey's markdown-composer group, one commit each. They touch different files and can be reviewed separately.

Whether a drag is in progress

dragging(el, on) wrote an lf-dragging class, and four modules read it back with document.querySelector: the projection presenter, the widget controller (twice), composing/engagement.js, and lf-board's grab row. widget-elements.js now keeps the hands in a set. dragHeld() says whether any widget holds one, and watchDragRelease(fn) tells the two deferral mechanisms (projection and widget controller) when the last one is put down. They are told in the order they started watching, which is the order the document event reached them before. lf-board reads its own gesture state instead of its class.

Behaviour that moved: nothing wears lf-dragging any more, since no stylesheet or package read it. The tests that watched the class now call dragHeld() through the runtime import.

Returning focus when a layer closes, and what a Tab stop is

Each closer wrote its own return. The command reference retried its origin for one frame, then let go. The response bar focused its proxy and let go if that failed. The Page Map, the thread card, the options menu, the tray, the thread panel, the reaction palette, the media viewer and the target chooser each focused one control, some after a visibility check and most with no fallback, so a destination that had gone left focus on the body.

handBack(...places) in focus.js now owns this:

  • It lands the user on the first place that takes focus.
  • A place that is still in the document gets one more try on the next frame. If focus is placed anywhere during that frame, whether by the user or by a caller that landed them itself, the retry does nothing.
  • If nothing lands, it calls letGo. The body counts as no place.

The Map's fallback chain is now mapControlPlaces(entry), a list that the dialog, the thread card and Map navigation pass to handBack.

Tab stops were spelled three ways: reach.js FOCUSABLE, the command reference's own selector, and margin-layout.js CONTROLS. focus.js now owns TAB_STOP, which adds summary and editable regions to FOCUSABLE, and tabStops(root), the filtered list that the reference and the auxiliary surfaces both use.

focus.js still imports nothing that imports it back, because several modules build selectors from TEXT_BOX while they load. So the retry tells that the user moved from focusin events rather than from user-intent.js.

Behaviour that moved:

  • A scrolling box whose only control is a disclosure no longer gets an extra tab stop from the reach sweep.
  • A closer whose destination has gone now lets the user go on the page (their next Tab continues from the block they are reading) rather than leaving focus on the body.
  • The target chooser, when closed with nothing focused beforehand, now lands the user on the block they are reading rather than at the top of the document.

Tests

  • test_a_disclosure_is_a_scrolling_box_s_own_stop and test_a_closing_layer_hands_the_user_back_to_the_first_place_that_takes_them are new, in tests/test_render_controls.py. I broke each rule in turn (summary, the body rule, the fallback to letGo, the one-frame retry, and skipping the retry once focus has moved) and confirmed that one of the two tests fails for each.
  • The existing closer, drag, board and swipe browser tests pass locally, as do npm run test:runtime and pre-commit.

margin-layout.js is also edited on the unmerged layout-survey branch. This change touches only its import line and controlsIn, and git merge-tree against that branch reports no conflicts.

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 26, 2026 15:37
`dragging` wrote an `lf-dragging` class and four modules read it back with
`document.querySelector`: the projection presenter, the widget controller (twice),
composing/engagement.js, and lf-board's grab row. widget-elements.js now holds the
hands in a set; `dragHeld()` answers whether any widget holds one, and
`watchDragRelease` tells the two deferral mechanisms (projection and widget
controller) when the last one is put down, in the order they began watching, as the
document event did. lf-board reads its own gesture instead of its class.

Behaviour moved: nothing wears `lf-dragging` any more. The tests that observed
the class now ask `dragHeld()` through the runtime import.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Closers each wrote their own return: the command reference retried its origin for a
frame and then let go; the response bar focused its proxy and let go when that
failed; the Page Map, the thread card, the options menu, the tray, the thread
panel, the reaction palette, the media viewer and the target chooser each focused
one control, some behind a visibility check, most with no fallback, so a gone
destination left focus on the body. `handBack(...places)` in focus.js now lands the
user on the first place that takes focus; a place still in the document gets one
more look on the next frame unless focus was placed meanwhile; with nowhere left the
user is let go on the page. The body is nowhere. The Map's own fallback chain
becomes `mapControlPlaces`, one list the dialog, the thread card and navigation
hand to `handBack`.

Tab stops were spelled three ways: reach.js `FOCUSABLE`, the command reference's
loop, and margin-layout.js `CONTROLS`. focus.js now owns `TAB_STOP` (which adds
`summary` and editable regions to `FOCUSABLE`) and `tabStops(root)`, the filtered
walk the reference and the auxiliary surfaces share.

Behaviour moved: a scrolling box whose only control is a disclosure no longer gets
a second tab stop from the reach sweep; a closer whose destination is gone lets the
user go on the page rather than dropping focus to the body; the target chooser
restored with no opener lands on the reading block rather than the top of the
document.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 66f34af into main Sep 26, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-a01c9cd000f506949 branch September 26, 2026 23:21
max-sixty added a commit that referenced this pull request Sep 27, 2026
The concept survey's drifted duplicates now each have one owner
(#1214–#1221, #1223, #1228, #1231, #1235, #1244, #1245, #1247, #1250,
#1251, #1254, #1260), so the survey note never lands. What it found and
nobody has taken becomes `TODO.md` entries:

- **Shared definitions** (new section under Next): re-addressing
resource references in one pass instead of `http.py`'s regex scopers and
three head composers; `tests/render_harness.py` `told()` beside
`pageReadiness`'s `data` and `log` stages (#1250), which answer the same
question; Python still naming a thread's identity a root
(`thread_roots`, `FrozenThreadReading.roots`) now that the runtime keys
threads on the served `id` (#1260).
- **Requests**: the existing "Decide whether requests earn their weight"
entry now says kept requests need one owner for seat availability, which
four runtime modules restate.
- **Implementation candidates**: the unresolved-gesture ledger as one
state machine, deferred until a change has to touch it, since nothing
there has drifted and it is the hottest race path.

The survey's small undrifted items and its list of deliberate splits are
dropped: none has drifted, and the splits are intended.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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