Skip to content

Unify clock presentation and native panel ownership - #2006

Merged
max-sixty merged 24 commits into
mainfrom
codex/simplify-ui-ownership
Oct 8, 2026
Merged

max-sixty merged 24 commits into
mainfrom
codex/simplify-ui-ownership

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Threads and Queue maintained separate paths for age-driven redraws, while covering panels manually maintained background inertness and keyboard modality. Clock changes now claim the shared presentation coordinator, and auxiliary panels share one retained native dialog boundary.

Panels and their permitted foreground have permanent homes inside the dialog; resizing changes its native modal posture without reparenting live descendants. Margin rows are inserted before that home so key hints retain native CSS anchoring. Nested native layers retain their order. Transient feedback measures settled foreground geometry after rollback and reserves reply height independently of scrolling. Composer admission reads the actual control across shadow roots.

Keyboard and read exposure share explicit-inert admission, including native modal escape from inherited inertness. Exposure reads the native layer owner's opening order in this document and its containing Leaf documents; closing a nonmodal panel also reports the resulting exposure change. A same-origin external host without that owner permits exposure only within every standing modal.

The change preserves draft, caret, scroll, disclosure and embedded browsing-context ownership. Behavioral regressions cover held preparation, obsolete paints and failure recovery, panel exchange and focus exclusion, nested inspectors/popovers, narrow refusal and retry, notices during long-thread scrolling, and complete widget comments after image inspection. Integration with main retains its compact resize grip.

Validation: 240 runtime tests, all 89 relevant browser cases and pre-commit pass on the integrated tree. Independent actual paths verify retained Chromium/WebKit contexts and drafts, key hints through covering and beside postures, public commands inside an inert wrapper, and exact read exposure under nested modal floors. Paired served startup profiles load the same 255 code requests, with 2,955 fewer code bytes by presentation; elapsed time is diagnostic. PR CI runs the complete landing gate.

This was written by Codex on behalf of max-sixty

The shared subscription lifetime registers data consumers once per element.
A shallow clone copies data-lf-done but has no subscriptions of its own, so
using that painted mark as the initialization guard prevented cloned text
documents from rendering their first data snapshot.

Keep initialization with the actual node in a WeakSet. Reconnecting retains
the original lifetime; a clone starts its own regardless of copied marks.
The existing asynchronous source-provenance browser case now completes, and
a base/candidate probe also verifies removing the mark cannot reinitialize
an already initialized node.
Board and swipe previews carry a compact label instead of cloning controls, widgets and sample frames. Real card moves use moveBefore, retaining iframe documents and unsent drafts through pointer and keyboard moves, cancellation, projection and undo.

Patch the pinned Sortable creation and relocation seams before insertion, and fail the build when an upstream seam changes. The board preview keeps the card width so the grip remains under the pointer.

Browser regressions protect original document identity, native control state and first-frame previews. The scroll cancellation test observes scroll start rather than a transient original-card viewport interval.
Move the shared media shelf and sent-image face into the common stylesheet used by document and shadow comments. Keep removal inside each tile so scrolling cannot clip its hit area. Tab opens response options only from the editor; native modal presses preserve the inert background composer.

Enqueue already claims presenters synchronously. Observe that pass without replacing its tickets, and remove the unused controller reference facade. Update the radius assertion to protect the tile enclosure rather than the child control. Native keyboard, pointer and touch paths, scoped browser regressions, runtime tests and independent review pass.
The upload response arrives before JSON decoding and draft admission finish. Wait on the composition input's aria-busy boundary in the shared paste helper, including multi-image pastes, so shortcuts run only once Send is available.
Threads and Queue request age paints through the presentation coordinator. Auxiliary panels share one retained native dialog boundary, including nested layers through resizing. Feedback reads settled foreground geometry, and composer admission uses the actual control across shadow roots.

Keep native draft, focus, caret and disclosure owners intact. Add behavioral contrasts for invalidation and failure, native layer exchange, narrow refusal/retry, and complete widget comments after image inspection.
…ership

# Conflicts:
#	skills/leaf/assets/runtime/chrome.css
leaf-agent
leaf-agent previously approved these changes Oct 8, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI test gate is red on this head, with two reproducible runtime failures:

  • The new portal calls envelope.moveBefore, which the WebKit browser in the suite does not provide. Opening an auxiliary surface throws before it can establish its dialog boundary; test_send_room_moves_to_every_line_only_while_the_field_scrolls[webkit_browser] records the exception. The portal needs a supported move path that still preserves focus and editor state.
  • test_reading_inside_a_long_thread_keeps_its_title_and_reply_row_on_the_lists_edges[narrow] reports a visible notice and its .lf-bottom-status moving down 34 px without input. That reproduced locally on this head. The new covered-panel status placement needs to keep the notice stationary as the panel reading settles.

The gate also has a stale structural assertion in test_notices_stay_at_the_visible_pages_right_edge: it requires the notice and panel to share a parent, while the new dialog puts them under different parents when the panel stands beside the page. The test's geometry and pixel checks passed before that assertion; update the stacking check to verify the visible relationship under the new structure.

@leaf-agent
leaf-agent dismissed their stale review October 8, 2026 01:39

CI failed: WebKit lacks moveBefore and the narrow Threads notice shifts without input.

Switch only native modal posture, retaining live editors and browsing contexts without reparenting. Admit inert keyboard scopes through the shared dispatcher and derive notice clearance from reply height rather than scroll position. Browser regressions hold actual paint order, stationary feedback and retained state in Chromium and WebKit.
leaf-agent
leaf-agent previously approved these changes Oct 8, 2026
…ership

# Conflicts:
#	skills/leaf/assets/leaf.js
leaf-agent
leaf-agent previously approved these changes Oct 8, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test gate is red on 7713b6a4 with two failures and one browser-fixture error; all three reproduced locally.

  • Closing a beside Threads panel no longer lets a newly exposed page-side answer become read. test_a_page_seat_the_open_panel_stands_over_is_not_read[900-True] observes no receipt after the panel closes. The retained envelope stays open in the nonmodal posture, so its close no longer fires the close listener in thread/read.js; that reader needs an observation pass when the occluding surface changes.
  • The new seat path produces an unchanged role write on the envelope during the auxiliary-surface exchange exercised by test_auxiliary_surfaces_replace_each_other_and_name_the_open_one[1200]. The browser fixture reports unchanged write: role on dialog.lf-ui.lf-auxiliary-envelope. Coalesce the transient seat changes so the DOM only receives the settled role.

The inline suggestion addresses the remaining structural assertion: the shortcut bar now sits inside the modal dialog and is explicitly inert while Threads covers the page, so modal containment cannot establish that it is background.

Comment thread tests/test_render_controls.py Resolved
@leaf-agent
leaf-agent dismissed their stale review October 8, 2026 03:00

CI failed on the reviewed head: read receipt, stale modal-containment assertion, and unchanged role write.

Permanent foreground homes separate ownership from activity. Read exposure now selects the last-opened modal from the native owner, shares inert admission with keyboard scopes, and observes auxiliary reach changes when a nonmodal panel closes. The cross-document reading preserves same-origin sample exposure; an external host without Leaf provides conservative native containment evidence.

Regression checks cover nested covering dialogs and a sample inside a native modal under an inert ancestor. The background-bar assertion now protects actual pointer and focus exclusion instead of a transient DOM parent.
@max-sixty
max-sixty merged commit 4ba3a71 into main Oct 8, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/simplify-ui-ownership branch October 8, 2026 04:11
max-sixty added a commit that referenced this pull request Oct 9, 2026
…2036)

Every focus the runtime and the packages place now goes through
`focusDestination(node, cause)`, with the cause `move`, `step`, `return`
or `press`, and every reader of where the user stands (`onStanding`)
hears that cause. Before, about a hundred plain `focus()` calls
published as the user's own move, and owners marked their own returns
with flags only their own listeners read, so a return released held
news, opened a margin cluster's options or chose a panel card the user
never went to.

This is phase 2 of the focus overhaul, the first of three stacked PRs:
this one against `main`, phase 3 against `focus-phase-2`, phase 4
against `focus-phase-3`. Phase 1 landed as #1967.

- focus.js: `focusDestination` takes the cause; `returningFocus`,
`placeChrome` and `handingBack`, and the `placing`/`handing` flags
behind them, are gone. A placement inside another (a component's focus
handler forwarding to its child, `forwardFocus`) keeps the outer cause;
a placement made by a reader of standing names its own and counts as a
placement. A closing layer's own hand-back, which the platform makes as
a popover or dialog closes, is no newer word to a waiting hold. The
cause `press` is a route landing on a control to press it, as a go-to
does, which opens nothing on arrival, or a control focusing itself under
the user's press, as lf-trace's timeline markers and image do.
- A native layer's own opening and closing steps (`showModal`, `close`,
`hidePopover`), which move focus the platform's way, run inside
`nativeLayerSteps(steps)`: what they do with focus is the layer's
return, and no newer word to a hold waiting across them. Main's native
auxiliary dialog (#2006) re-seats its envelope and the layers above it
this way, where it had used `returningFocus`.
- A stop is lent only to a drawn element that is no control of its own,
and landing is read as focus on the element or inside a shadow tree it
hosts (`standsIn`), so a text field whose editor took focus is landed on
and not focused twice.
- The returns that published as moves now say `return`: the banner's
refocus of its door and of the control after a removal, the thread
panel's invoker, the reaction list's own return, surface.js's return to
Threads, the margin's cluster repaint, card transfer and
`restoreStanding`, and the carries across a re-render (RowFocus, the
swipe deck, the board's grip, the thread card's hand-on, history and
draft restores, a contribution activation's hand-on to the entry that
replaced the pressed one, the Asks view's restore after a revision, the
playground's return from a native range, lf-draft's return to the draft
or its Edit control as its editor closes, and the covering surface's
entry, which main had wrapped in `returningFocus`).
- Flags deleted: auxiliary-surfaces' `placingFocus`, the margin's
`settlingOptionsFocus` and `suppressingOptionsArrival`, and the page
map's `closeOwnsFocus` (every way out of the map now places focus itself
as it closes the dialog; the `close` event places nothing). The margin's
two cluster `focusout` listeners and its card's reply-row `focusout` are
`onStanding` readers, so switching windows no longer folds a margin
entry's options. The fold reads the node the user left: a node hidden
under the user folds what it opened, and a node removed from under them
folds nothing, since the render that removed it hands them on to its
replacement.
- An auxiliary surface's `focus()` is `landing()`, the node a covering
surface lands the user on, so `.focus()` means only the element's.
- The lint `architecture/placements` refuses a plain `focus()` outside
focus.js and the text field (whose own `focus()` hands on to its
editor), requires a cause at every `focusDestination` call, and refuses
passing the function on as a value. `focusForNavigation`, a
contribution's `focus(entryKey, cause)` and `focusThread` take the cause
too.

Behavior that changed:
- A go-to or a generated route that lands on a margin control and
presses it no longer opens the cluster's options and folds them again
under the press; a travel landing on a margin control is a `move`, which
opens a folded cluster as the keyboard arriving does.
- `lf-diff`'s hunk walk and `lf-sample`'s return borrow a stop that
leaves with the user instead of leaving `tabindex="-1"` on the rows and
the sample host.
- Fallbacks that called `document.body.focus()`, which did nothing, are
gone.

Tests: tests/runtime/focus.test.mjs asks that a move, a return and a
step each reach `onStanding` with the cause the placement names, and
that a placement naming none is refused; it fails before
`focusDestination` took a cause. `npm run test:runtime` (255) and eslint
pass. The focus browser suites (chrome contracts, navigation, controls,
threads, widgets, margin, anchors, drafts, reactions, aim, read state,
interaction layer, send placement) fail 7 and pass 2164, the same 7 that
fail on main (dc26922);
`test_resume_reveals_an_open_draft_when_its_existing_subject_hides`, the
Resume journey #2078 fixed, passes.

> _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 12, 2026
…f's type (#2613)

Trying [lintapple](https://github.com/gholtzap/lintapple) on Leaf's
pages (#2559) turned up mostly noise, but its unmeasured contrast
readings traced back to Leaf: the auxiliary envelope, a transparent
`<dialog>` the size of the window, stood over the first screen. axe
hit-tests text to find its background, so it answered every word under
the envelope as "incomplete", and the suite's axe sweep, which keeps
violations only, passed words it never measured. This has been the case
since the envelope landed in #2006.

**Envelope.** `.lf-auxiliary-envelope` is now an empty box at the
document's origin. Everything it holds positions against the window or
that origin, and the stylesheet comment states the rule a future child
must keep. A reviewer compared every visible envelope descendant between
main and this branch on review-a-plan, at 1440×900 and 390×844, in 15
chrome states (panels, hints, menus, command reference, page search,
design mode, page comment). Every rect matched. On triage-board, axe's
overlap incompletes at rest went from 42 to 8; the remaining 8 are
gradients and short text.

**Sweeps.** A new `overlapped_words` reading fails the feature-gallery
axe sweep on any word axe reads no contrast for because boxes that paint
nothing stand over it. Painted covers the layer puts there on purpose,
such as a scroller's edge fade or a margin pin, hide words from the
reader too, so they don't count. With the old envelope the check fails
on the gallery's title, lede and start section in all four views. The
chrome sweep now waits for the thread panel's slide: mid-slide, the
panel's words stood past the window's edge and went unread. That sweep
can't take the overlap check yet, because `.lf-thread-controls` is a
transparent box over the first message's author and time. TODO.md files
that under the Threads redesign.

**Authored controls.** A `<button>` or `<input>` a page writes in `main`
without a class drew in the browser's 13.33px Arial. It now takes Leaf's
control type from the weightless face rule in `surfaces.css`, so any
page rule still wins. Measured over the corpus page's 515 controls, only
the gallery's bare buttons changed. `page-authoring.md` now names
`.button`, `.button.primary` and `.field`, which give an authored
control Leaf's full face, and the feature gallery's six bare controls
use them.

**Review stable.** developing-leaf's "External UI skills" table adds
[Emil Kowalski's skills](https://github.com/emilkowalski/skills):
`review-animations` for motion and `break-ui` for worst-case content.

Tests: the gallery and chrome axe sweeps, a new authored-controls test
(each checked by reintroducing the bug, which made it fail), 11
envelope-sensitive browser tests, and the corpus test.

Closes #2559

> _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 Nov 4, 2026
…og (#5360)

The chrome's foreground layer (it holds the floating panel, hint layers
and the chrome's own dialogs) is now a plain `div` with `tabindex="-1"`.
Before, it was an open nonmodal `<dialog>`. #5336 gave that dialog
`role="generic"` so Chrome would stop exposing it as an unnamed dialog
around the panel, but [ARIA in
HTML](https://www.w3.org/TR/html-aria/#el-dialog) permits no such role
on `dialog`, as max-sixty pointed out on #5336. A `div` is generic
natively, so it needs no role.

Nothing still needed the element to be a dialog:
- Native layers opened inside it (the command reference, page map,
popovers) still stand in the top layer, because the browser puts them
there no matter what holds them.
- Nothing calls `show`/`showModal`/`close` on the layer. Its old modal
posture (#2006) is gone.
- The one `closest("dialog, [popover]")` reader (`focus.js`,
`leftClosedLayer`) gets the same answer, since an open dialog there
already counted as "still standing".

`tabindex="-1"` stays, so Tab order and focus are unchanged. The layer
has no Tab stop, so the Firefox stop removed in #5039 stays gone. A
press between the panel's controls still focuses the layer instead of
dropping focus to the body. Paint order doesn't change: the layer keeps
its place in the chrome and its `position: absolute` box at the origin.
The CSS that cancelled the browser's dialog styling (border, padding,
max size, background) goes with the dialog. A stale comment in `leaf.js`
about the hints' "native modal ancestor" goes too.

Verification, on current main:
-
`test_borrowed_scroll_stops_leave_code_selection_and_marks_with_their_owners`:
all three cases pass. It fails when the layer is exposed as a dialog.
- `tests/browser/controls/test_focus.py` passes, including the Tab-order
test in Chromium and Firefox. So does
`tests/browser/widgets/test_code_and_documents.py`, which includes the
zero-dialog check.
- `pnpm run test:runtime` and `pnpm run check` pass.

Refs #5126 and #5336.

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