Skip to content

fix: size the floating panel against its viewport so root zoom can't push it past the window - #5362

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-5142
Nov 4, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-5142

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

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 after

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

…push it past the window

Since #5039, a window narrower than `--lf-rail-room` opens the thread Send
starts in the floating panel, not a margin card, so
`test_a_zoomed_floating_draft_and_sent_comment_fit_a_narrow_window` waited
for a card that no longer opens there. Reading the panel instead showed it
overran the window: the panel's width was `min(540px, 100vw - gutter)`, and
a page's root `zoom` scales the panel but not `100vw`, so at zoom 1.25 in a
605px window the panel stood 675px wide and cut off Resolve and Close. The
width now subtracts the gutter from `100%` of the viewport the panel is
fixed to, which zoom scales with it. Unzoomed, the panel is unchanged.

The test now checks the panel thread fits the narrow zoomed window, then
widens the window and checks the card the thread moves to shows its words.
It drops its transformed-holder case: since #5228 Leaf's chrome root stands
after `body` as a 0x0 box, so that case's page rule transforming
`div.lf-chrome` made it a zero-width containing block, and the draft never
took focus; its local `zoom` on `.lf-fab-bar` already lost to the chrome
guard. No page markup can put Leaf's surfaces under a transform now.

Closes #5142
@max-sixty
max-sixty merged commit a8da78e into main Nov 4, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/issue-5142 branch November 4, 2026 11:08
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.

Zoomed comment opens without the expected visible margin card

2 participants