Skip to content

Keep floating comments visible under CSS zoom - #2232

Merged
max-sixty merged 13 commits into
mainfrom
codex/fix-thread-scroll-zoom
Oct 10, 2026
Merged

max-sixty merged 13 commits into
mainfrom
codex/fix-thread-scroll-zoom

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

At 125% root CSS zoom in a narrow window, typing a comment could make its editor disappear: Floating UI 1.8.0 mixed viewport pixels with positioning pixels when the offset parent was Window, so Leaf concluded that a usable draft did not fit.

Backport Floating UI's merged CSS-zoom correction into the reproducible vendor build, applying its patch to private package copies. Leaf now derives fit measurements, native anchor offsets, and client rectangles from the platform's canonical coordinate conversion. The earlier submitted-text width correction remains necessary independently.

Browser regressions cover typing and sending at 125% CSS zoom in a 605px window, and right/bottom held-edge placement with root and nested zoom. The latter compares rendered edges with the reference using the real solver and fails if the viewport-to-positioning conversion is removed. The transformed-holder regression now follows the current attached-draft contract: the same editor follows its passage offscreen, retains its allocation and text, and Resume reveals it.

CI also exposed a stability-sensor attribution gap when combined with newer message typography: a startup-created native scroll timeline correctly carried an Ask marker with its shadow reader, but the sensor reported that scroll as movement without input. The sensor now credits native attachments from their measured source scroll, including uniform coordinate rebases, and converts all sampled animation translations to viewport pixels. Changed trajectories, range or layout changes, and independent local movement still fail, including beneath scaled and zoomed ancestors.

Validation: the new regression failed before the fix and passed afterward; the four submitted-text wrapping cases, transformed-holder journey, 288 runtime tests, macOS thread appearance gate (11 passed, one skipped), and configured pre-commit checks passed. Before/after startup loaded the same 244 requests with about 820 additional JavaScript bytes. The proof page includes paired captures and a live sample.

The sensor repair passes 36 focused browser cases with every-frame verification, plus the original mobile package-reader journey with CI's typography. A deterministic scroll-and-paint reproduction fails before the repair and passes afterward with identical 10px marker and target travel; mutation checks verify the negative controls against extra local motion and passive trajectory changes.

This was written by Codex on behalf of max-sixty

Use maintained dependencies for established capabilities, including prototypes,
while retaining native platform and standard-library reuse. Keep browser builds
in Leaf's development and release pipeline so consumers receive ready assets.
Backport Floating UI upstream #3492 into the reproducible vendor build and derive fit, native anchor offsets, and client rectangles from its canonical coordinate conversion. At 125% root CSS zoom in a narrow window, typing and sending now keep the comment visible and contained.

Protect the narrow zoomed draft/send journey. Update the transformed-holder regression to the current attached-draft contract: it follows its passage offscreen, retains the same native editor and allocation, and Resume reveals it.

@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 window-plane held-edge placement still needs a correction under root CSS zoom; see the inline finding.

Exercise real Floating UI placement in the window plane with right/bottom held edges. Root client dimensions in standards mode are viewport pixels, so dividing by cumulative floating scale is required; quirks-mode root measurements do not describe Leaf documents.
leaf-agent
leaf-agent previously approved these changes Oct 10, 2026
@leaf-agent
leaf-agent dismissed their stale review October 10, 2026 08:34

The current head has a failed test check (test_primary_package_reader_retains_native_widgets_drafts_and_creation[390]); approval is withheld until CI is green.

Credit startup-created native scroll timelines from their retained source scroll, with stable trajectory and range proof. Preserve uniform coordinate origin rebases without excusing independent local movement. Convert sampled native and ordinary animation translation through one viewport basis, including scaled ancestry and target CSS zoom.

CI combined this branch with newer message typography, which made the mobile package reader scroll 10px on its first Ask. The marker followed its target correctly; the stability sensor lacked startup scroll attribution. A deterministic scroll-plus-paint reproduction failed before this repair and passes with identical geometry afterward. Thirty-six focused browser cases pass with every-frame verification, and targeted mutations verify the negative controls.
@max-sixty
max-sixty merged commit 879ca65 into main Oct 10, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex/fix-thread-scroll-zoom branch October 10, 2026 09:32
max-sixty pushed a commit that referenced this pull request Nov 4, 2026
…push it past the window (#5362)

Since #5039, a window narrower than `--lf-rail-room` (958px with Leaf's
theme) opens the thread a new comment's Send starts in the floating
panel, not a margin card.
`test_a_zoomed_floating_draft_and_sent_comment_fit_a_narrow_window`
still waited for a card at 605px and 315px, so it failed in every run
since the 11-02 nightly (#5142). Rewriting it to read the panel exposed
a product defect: under a page's root `zoom: 1.25` in a 605px window,
the panel was 675px wide and cut off its own Resolve and Close.

**Cause.** The panel's width was `min(540px, 100vw - gutter)`. A root
`zoom` scales the panel but not `100vw`, so the zoomed panel was wider
than the window. The width now subtracts the gutter from `100%` of the
viewport the panel is fixed to, which zoom scales with the panel. At
zoom 1 the result is the same, apart from no longer counting a classic
scrollbar's width. `leaf-dev stills` shows `floating-thread` and
`ship-threads` unchanged at phone width, and `floating-thread` unchanged
at 560x800.

| Before (root zoom 1.25, 605px window) | After |
| --- | --- |
|
![before](https://github.com/user-attachments/assets/7ce6d8cd-c200-4895-86e6-58f79505ace9)
|
![after](https://github.com/user-attachments/assets/447d21b9-322e-4f92-9c17-c25fae3fb7af)
|

**Test.** At a narrow window under root zoom, the test still holds the
draft inside the window, as #2232 meant it to. After Send it now checks
that the panel shows the thread and fits the window. It then widens to
1440px and checks that the card the thread moves to shows its words
unclipped. The test fails on main at the panel's bounds and passes with
the CSS change.

It drops the `transformed-holder` case. That page transformed
`div.lf-chrome`. Since #5228, Leaf's chrome root stands after `body` as
a 0×0 box (`base.css`, `:root > .lf-chrome`), so the transform turned it
into a zero-width containing block, and the draft never took focus. The
test failed there on main, earlier than the card check, and bisecting
puts the break at #5228. The case's local `zoom: 1.2` on `.lf-fab-bar`
already lost to the chrome guard (computed `zoom` 1). Ordinary page
markup can no longer put Leaf's surfaces under a transform, so the case
protected no reachable page.
`test_a_scaled_floating_draft_keeps_its_room_when_its_passage_scrolls_away`
still covers a scaled draft.

**Left open.** Several other chrome rules also size against `100vw`,
such as `chrome.css`, `annotation-chrome.css`, `controls.css` and the
`--lf-float-w` fallback. I haven't checked which of them overrun the
window under a root `zoom`.

Closes #5142 — 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