Skip to content

fix(design): a frame's page never loses width to its own scrollbar - #106

Merged
flowtricks merged 3 commits into
flowtricks:mainfrom
SylvainDruaux:fix/design-frame-scrollbar
Nov 27, 2026
Merged

flowtricks merged 3 commits into
flowtricks:mainfrom
SylvainDruaux:fix/design-frame-scrollbar

Conversation

@SylvainDruaux

@SylvainDruaux SylvainDruaux commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

In Design mode, a frame whose page is taller than 30,000 px showed Chromium's own scrollbar on Macs that draw classic scrollbars (Show scroll bars: Always, or Automatic with a mouse). The page was then laid out 15 px narrower than the frame's label says (781 in a frame labelled 796).

Each frame's document now gets the editor canvas's existing rule (CANVAS_SCROLLBAR_CSS) when it loads. Design mode frames run no script, so the canvas's message never reached them.

Why it matters

  • A phone-width frame makes a long page tall enough to pass the cap, so the page drawn there is narrower than the breakpoint shown.
  • designModeUnlinkSoak failed on any Mac with classic scrollbars at its width check ("f1 drawn 796 pixels wide … last observed: 781").

The unlink soak's pixel check

With the width fixed, the soak reaches its pixel comparison on such a Mac, where it failed every run with "largest channel difference 2". The before and after captures differed in 16 pixels only, all on the anti-aliased edge of the scoped card's two left corners (15 by one level, one by two); boxes and computed styles were identical. The element check now allows up to 16 pixels past one level, each within the 8 levels the frame is already held to. A real change still fails: shifting the card's colour by 12 levels puts 452,144 pixels past the level.

Design mode soaks and screen recording run alone

On a 10-core, 16 GB M1 Pro, the default full gate failed four Design mode soaks and screenRecordingElectron on waits and frame rates that ran out while other Electron windows shared the CPU; each passed on its own. testSuites.ts already says suites that measure timing or drive a real window run alone, so these five now do. CI skips them (macOS only), so CI time is unchanged; on a Mac the gate grows by a few minutes (about 17 minutes in total here). The four new entries name Design mode tests, so designModeBoundary and docs/design-mode/REMOVE.md list testSuites.ts as an integration point.

Tests

  • New: test/renderer/app/designMode/designFramePageScrollbar.test.js
  • Full gate: 1560/1560 on an M1 Pro, at the default parallelism.

On a Mac that draws classic scrollbars (System Settings → Appearance → Show scroll bars: Always, or Automatic with a mouse connected), a Design mode frame whose page is taller than the frame's 30,000 px cap scrolls inside itself and shows Chromium's scrollbar. The page is then laid out 15 px narrower than the width on the frame's label: 781 px in a frame labelled 796. A phone-width frame makes a page much taller, so an ordinary long page can reach the cap there. The same narrowing is why designModeUnlinkSoak fails on such a Mac ("f1 drawn 796 pixels wide … last observed: 781") and passes with "Show scroll bars: When scrolling".

The editor canvas already hides the page's own scrollbar and gives every frame its whole width (canvasScrollbar.ts), but it does so through a message that a script in the frame applies, and Design mode frames run no script. Each frame's document now gets the same rule, CANVAS_SCROLLBAR_CSS, when it loads and before its height is measured. Nothing is lost: the canvas takes every pointer, so a frame is never scrolled from inside.

A new test checks that the rule is written once into the frame's <head> and keeps the page's own styles; designModeUnlinkSoak holds the width itself on a Mac with classic scrollbars.
Once a frame's page keeps its whole width on a Mac with classic scrollbars, designModeUnlinkSoak reaches its pixel comparison there, and on an M1 Pro it failed every run with "the unlinked element is painted the same (largest channel difference 2)". The before and after captures of the probe differed in 16 pixels only, all on the anti-aliased edge of the scoped card's two left corners, 15 of them by one level and one by two; text, fills and every straight edge were identical, as were the boxes and computed styles the soak compares exactly. A GPU blends a curved edge slightly differently from one draw to the next, and the steady difference depends on the machine, so a one-level limit on every pixel cannot hold everywhere.

The element check now allows up to 16 pixels past that level, each within the 8 levels the whole frame is already held to, and every other pixel within one level. A changed look still fails: shifting the same card's colour by 12 levels puts 452,144 pixels past the level. A failure now reports the largest difference and how many pixels were past it, and the report keeps both.
The gate's own rule puts suites that measure timing or drive a real window in the alone phase, one at a time with nothing else running. Four Design mode soaks and the screen recording probe were in the shared pool instead. On a 10-core, 16 GB M1 Pro, the default full gate (four Electron windows at once among nine suites) failed designModeSoak, designModeControlsSoak, designModePagesSoak and designModeUnlinkSoak in two runs, on waits that ran out (a frame never drawn within 30 s, a page that never finished opening, a copy not drawn within 100 ms), and each passed on its own. With --electron-jobs=1 the three that had no other fault passed in three runs out of three. screenRecordingElectron failed the same way under load: its frame-rate checks fail outside CI, and e355e30 records a loaded macOS runner at 0.8 fps.

They now run alone. CI's Linux and Windows runners skip all five (macOS only), so CI time does not change. On a Mac the alone phase grows by about 8 to 10 minutes (designModePagesSoak alone took 234 s), so a full gate there takes roughly 22 to 24 minutes, under the push hook's 30-minute bound. designModeResizeSoak and designModeCrashSoak passed in every run and stay in the pool.

Four of those entries name Design mode's test files, so scripts/gate/testSuites.ts becomes one of its integration points: designModeBoundary lists it with its four lines, and docs/design-mode/REMOVE.md says to remove them with the feature.
@flowtricks
flowtricks merged commit a4e046c into flowtricks:main Nov 27, 2026
20 checks passed
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