Skip to content

fix(canvas): hide the page's scrollbar before the first paint - #107

Merged
flowtricks merged 1 commit into
flowtricks:mainfrom
SylvainDruaux:fix/canvas-scrollbar-flash
Nov 27, 2026
Merged

flowtricks merged 1 commit into
flowtricks:mainfrom
SylvainDruaux:fix/canvas-scrollbar-flash

Conversation

@SylvainDruaux

Copy link
Copy Markdown
Contributor

Opening a project showed Chromium's scrollbar in each canvas frame for a moment before the canvas's own bar replaced it. The app tells a frame to hide its bar on the iframe's load, which fires after every picture and font, so on a Mac with classic scrollbars the page first painted with Chromium's bar and 15 px less width.

A canvas frame now hides the bar itself as its preload starts. Its URL already says it is the canvas's (#avb-design, as markFrameMode reads it), and every canvas frame has the canvas's own bar beside it (SizedFrame.tsx, CanvasView.tsx), so no page is left without one.

How

  • The rule (CANVAS_SCROLLBAR_CSS) goes into the document's adopted style sheets: no element is added to the page, so the column guide, the outlines and the canvas patcher see no change, and a document whose does not exist yet takes it too.
  • A frame that is not the canvas's keeps Chromium's bar until the app's word, as before.
  • In Studio the preview client is a module script, so it hides the bar once the page is parsed rather than before the first paint, still earlier than on load.

Tests

  • canvasScrollbarChromium (real Electron window): a canvas frame has hidden its bar and lays a 320 px page out at 320 px before the app's word; a frame without the canvas's mark keeps Chromium's bar.
  • frameScrollbar.test.js: the rule adds no element to the page and is adopted once; a document without adopted style sheets waits for the app's word.
  • Checked by eye on a Mac with classic scrollbars: no flash when opening a project, switching pages or reloading.
  • Full gate: 1560/1560.

Opening a project showed Chromium's scrollbar in each canvas frame for a moment before the canvas's own bar replaced it. The app tells a frame to hide its bar on the iframe's load, which fires after every picture and font, so on a Mac with classic scrollbars the page first painted with Chromium's bar and 15 px less width.

A canvas frame now hides the bar itself as its preload starts. Its URL already says it is the canvas's (#avb-design, as markFrameMode reads it), and every canvas frame has the canvas's own bar beside it (SizedFrame.tsx, CanvasView.tsx), so no page is left without one. The rule goes into the document's adopted style sheets: no element is added to the page, so the column guide, the outlines and the canvas patcher see no change, and a document whose <html> does not exist yet takes it too. A frame that is not the canvas's keeps Chromium's bar until the app's word, and a document without adopted style sheets (jsdom) waits for it as before. In Studio the preview client is a module script, so it hides the bar once the page is parsed rather than before the first paint, still earlier than on load.

canvasScrollbarChromium now holds, in a real Electron window, that a canvas frame has hidden its bar and lays a 320 px page out at 320 px before the app's word, and that a frame without the canvas's mark keeps Chromium's bar; frameScrollbar.test.js holds that the rule adds no element to the page and is adopted once.
@flowtricks
flowtricks merged commit c446bea 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