Skip to content

Sidebar: let go, the edge is where it was released, not easing the last pixels - #2119

Merged
davidmckayv merged 1 commit into
mainfrom
fix/sidebar-zoom-drag-flake
Nov 24, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
fix/sidebar-zoom-drag-flake

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

The WebKit job's sidebar-zoom-drag case "a width dragged wide at 100% is held to two-fifths zoomed in" failed now and then with width: 288 → 291, on PRs that never touched the sidebar.

Cause: the product, not the test

When the release reached the page before React had drawn the last move, the last width was drawn in the same style change that turned the sidebar's 200ms width ease back on. So the sidebar eased its last few pixels after the pointer instead of being where it was let go. A probe caught it in the act in WebKit: { width: 291, stored: "288", animations: ["width:running"], resizing: false }. 291 is the drag's second-to-last step.

That happens whenever the move and the release arrive close together: a busy window, or a browser handing over a held-back move just before the release. Playwright's back-to-back mouse.move/mouse.up hit it about 1 run in 9 under WebKit.

Fix

On release, SidebarRail now:

  1. draws the released width at once (flushSync)
  2. lays the panel out at that width while easing is still off
  3. only then turns easing back on, so there is nothing left to ease.

The 288 expectation is unchanged.

Tests

  • New case, "let go just after the last move, the sidebar is drawn at the released width at once": it dispatches the last move and the release together. Before the fix it failed every run (3 of 3, 308 drawn for 288). It passes now in both engines.
  • The flaky case under WebKit and Chromium: 5 of 45 runs failed before the fix, every one with 291 for 288. After the fix it passed 100 runs in a row. These runs used headless Playwright WebKit 2336, the same revision as CI's image.
  • The whole sidebar-zoom-drag file (14 cases) and sidebar-window-buttons pass in both engines. Typecheck and Biome are clean.

@davidmckayv
davidmckayv force-pushed the fix/sidebar-zoom-drag-flake branch 2 times, most recently from 6ab9e8a to cc83c51 Compare November 24, 2026 04:49
…st pixels

When the release reached the page before the last move had been drawn (a busy
window, or a browser handing over a held-back move just ahead of the release),
the last width was drawn together with the sidebar's 200ms ease coming back,
so the sidebar eased the last few pixels after the pointer. That is the
"width 288 -> 291" the WebKit job hit now and then in sidebar-zoom-drag.

On release the rail now draws the released width at once (flushSync), lays
the panel out at it while easing is still off, and only then turns easing
back on, so there is nothing left to ease.

A new case dispatches the last move and the release together, which failed
every run before (308 drawn for 288) and passes now, in both engines.
@davidmckayv
davidmckayv force-pushed the fix/sidebar-zoom-drag-flake branch from cc83c51 to 36ab82d Compare November 24, 2026 05:06
@davidmckayv
davidmckayv merged commit d7891b7 into main Nov 24, 2026
23 checks passed
@davidmckayv
davidmckayv deleted the fix/sidebar-zoom-drag-flake branch November 24, 2026 05:26
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.

1 participant