Skip to content

fix(preview): canvas frames keep the breakpoint's whole width - #95

Merged
flowtricks merged 3 commits into
flowtricks:mainfrom
SylvainDruaux:fix/canvas-overlay-scrollbar
Nov 24, 2026
Merged

flowtricks merged 3 commits into
flowtricks:mainfrom
SylvainDruaux:fix/canvas-overlay-scrollbar

Conversation

@SylvainDruaux

Copy link
Copy Markdown
Contributor

A canvas frame drew Chromium's own scrollbar, which takes about 15px of the page on a computer with classic scrollbars, so a 320px phone frame laid its page out in 305px while its media queries still read 320, and text wrapped where it never does on a phone. Frames now draw no root scrollbar: the page gets the frame's whole width at every breakpoint, as on a real phone or tablet.

The canvas draws its own thin scrollbar instead, as Webflow does: a solid 5px thumb 2px outside the frame, always visible and draggable, never over the page. Desktop's frame keeps a 9px gutter on each side for it, and the toolbar and the style panel read the page width that remains.

Settings > Editor > Canvas can give Chromium's real scrollbar back from a breakpoint up: "Laptop and wider", "Desktop and wider" or any wider breakpoint the project has, by its own name. Tablets and phones are not offered, since their own scrollbar floats over the page. Desktop starts one pixel past the widest narrower breakpoint, so the choices follow the project's breakpoints however many there are.

The preference's parser is a module of its own, so the IPC contract graph grows by one module rather than by the whole scrollbar module. Tests that pinned Desktop at the pane's full width now expect the width less the two gutters.

The second commit makes canvasCaptureOutlinesChromium tolerate a display's colour conversion: on a Mac with a wide-gamut display, capturePage returns the magenta toolbar (#ff00ff) as 255, 3, 255, so every scenario failed locally and blocked the pre-push gate. Drop it if you'd rather fix it another way.

How to check

  1. Open a project on a computer with classic scrollbars (Windows, or macOS with "Show scroll bars: Always").
  2. Phone (320px) frame: the page lays out at the full 320px; a thin bar sits just outside the frame and scrolls the page when dragged.
  3. Desktop: a 9px gutter on each side of the frame, with the bar in the right one.
  4. Settings › Editor › Canvas › "Laptop and wider": Laptop, Desktop and any wider breakpoint show Chromium's own scrollbar again; Tablet and Phone keep the thin bar.

A canvas frame drew Chromium's own scrollbar, which takes about 15px of the page on a computer with classic scrollbars, so a 320px phone frame laid its page out in 305px while its media queries still read 320, and text wrapped where it never does on a phone. Frames now draw no root scrollbar: the page gets the frame's whole width at every breakpoint, as on a real phone or tablet.

The canvas draws its own thin scrollbar instead, as Webflow does: a solid 5px thumb 2px outside the frame, always visible and draggable, never over the page. Desktop's frame keeps a 9px gutter on each side for it, and the toolbar and the style panel read the page width that remains.

Settings > Editor > Canvas can give Chromium's real scrollbar back from a breakpoint up: "Laptop and wider", "Desktop and wider" or any wider breakpoint the project has, by its own name. Tablets and phones are not offered, since their own scrollbar floats over the page. Desktop starts one pixel past the widest narrower breakpoint, so the choices follow the project's breakpoints however many there are.

The preference's parser is a module of its own, so the IPC contract graph grows by one module rather than by the whole scrollbar module. Tests that pinned Desktop at the pane's full width now expect the width less the two gutters.
On a Retina Mac, capturePage returns the magenta toolbar (#ff00ff) as 255, 3, 255: the display's colour conversion moves green by 3, past the check's 2-unit tolerance, so the whole-window capture read as having no toolbar and every scenario failed locally. The toolbar is now recognised as clearly magenta (red and blue high, green low), which no such conversion turns into the white stage or an outline colour.
The fluid Desktop frame leaves a 9px gutter on each side for the canvas's scrollbar, but the overlay layer above it (outlines, column guides, drop indicators) kept the pane's full width. Both are centred, so every overlay drew 9px left of the page and 18px too wide. The frame and its overlay layer now take one width, FLUID_FRAME_WIDTH, in the app and in Studio, and a test pins that the layer covers exactly the fluid frame.
@SylvainDruaux

Copy link
Copy Markdown
Contributor Author

CI: all checks pass except macOS shard 1/4 (and the test (macos-latest) summary job that reports it). The one failing suite is electron/documents/pageEdit, in "an edit that sets a value the source already holds writes nothing at all": the folder watcher heard a late rename index.astro left over from the previous test, a macOS file-event timing issue unrelated to this PR. The previous run of this branch passed it, and Ubuntu and Windows pass it here. A re-run of that job should go green.

@flowtricks
flowtricks merged commit 9fe0e27 into flowtricks:main Nov 24, 2026
18 of 20 checks passed
flowtricks added a commit that referenced this pull request Nov 24, 2026
The owner does not want a scrollbar setting. Settings > Editor > Canvas
(the "Chromium scrollbar" breakpoint choice from #95) is gone with its
section, setting key, IPC/preload contract, defaults, 18 translations,
docs and Studio vendoring. There is one behaviour: every canvas frame
hides the page's own scrollbar and gets its breakpoint's whole width,
and the canvas draws its thin bar outside the frame. A classic bar from
some width up would lay pages out narrower than the breakpoint shown.

An old `canvasScrollbar` value in settings.json is never read. A damaged
value of a convenience preference (track/review changes, code chips,
language) now falls back to its own default instead of resetting every
setting; privacy and trust fields stay strict.

Also, from the #95 review:
- The all-breakpoints canvas now tells each frame to hide its bar and
  draws the canvas bar beside a frame whose page scrolls; before, its
  frames kept Chromium's bar and lost ~15px. CanvasScrollbar accepts
  zoom above 1 there (scale must be positive and finite).
- A page that scrolls <body> instead of <html> is hidden, read and
  scrolled through <body>; scroll is captured on the document.
- Side resize handles of a scaled frame sit 12 screen px out at any
  zoom, so they no longer cover the bar at mid-height.
- The bar sits at the frame's inline end (logical positioning).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@SylvainDruaux
SylvainDruaux deleted the fix/canvas-overlay-scrollbar branch November 24, 2026 15:13
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