Skip to content

fix(canvas): make a drawn frame's white a default a design's own background beats - #492

Closed
kgoedecke wants to merge 2 commits into
mainfrom
kgoedecke/frame-tool-paper-default
Closed

kgoedecke wants to merge 2 commits into
mainfrom
kgoedecke/frame-tool-paper-default

Conversation

@kgoedecke

@kgoedecke kgoedecke commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The Frame tool made an empty frame white by writing background: #ffffff inline on the document's <body> (drawingDocument). An inline style beats any stylesheet, so when a design was later put into a drawn frame, its own body { background: … } lost and the design sat on white.

For a dark design that is the remaining source of the light line along a frame's edge on a dark canvas (the one #440 could not reach): the frame's last pixel is blended by the compositor, and the white body under the dark design is what gets blended in. Measured in Chrome on such a frame, the edge pixel read 44–71 against a design of 16 and a canvas of 20.

This PR removes the white instead of correcting the blend.

Change

  • shared/framePaper.ts: the paper is now <style data-doop-paper>@layer doop-paper{:where(body){background:#ffffff}}</style>, first in the document's head. :where() has no specificity and the layer is declared before any a design brings, so a design's body background wins whether it is layered (Tailwind) or not.
  • drawingDocument writes that rule for the Frame tool instead of the inline style. drawingMove removes it where it used to clear the inline background (a shell made for a lifted element).
  • withPaperRule heals frames saved before: it turns the old inline white into the rule. It recognises only the exact pair the old Frame tool wrote (the shell style on html, and that shell plus the white as the body's whole style attribute), so an inline white a design chose is never touched, and it judges nothing about the design's CSS, so a rule that does not apply cannot take the white away. It runs wherever withFontFaces does (actions on every write, FrameView's save path), so an affected frame is fixed on its next save.

Verified

  • tests/framePaper.test.ts: the conversion, that it settles, and what it must not touch.
  • tests/framePaperBrowser.test.ts (Chromium): an unstyled body stays white, an inactive body.dark rule leaves it white, and unlayered, layered and zero-specificity design rules all beat the paper; a healed drawn frame shows the design's background and an empty one stays white.
  • A case in tests/drawing.test.ts: the Frame tool writes the rule and no inline background.
  • Also ran drawingMove, fontFrameWrites, designTokenWrites and drawingBrowser; typecheck, lint, format check and doc-lint are clean. The full suite has not been run locally.
  • Ran withPaperRule read-only against a real canvas in the dev app: its three drawn frames (two holding a dark design, one empty) were converted, body tag and head only, and converting again changed nothing; an agent-made frame was untouched.

Notes

  • A healed frame changes look where the design did not cover the body: in the frame this was found on, a 58px white strip under an 852px-tall dark design becomes the design's dark body colour.
  • Not covered, by design: a page that legitimately has a white body with a dark section touching the frame's edge can still show a faint line at some zooms. fix(canvas): snap frames to whole device pixels at rest #485 (device-pixel snapping) was closed in favour of this.
  • I did not save a healed frame and re-measure its edge in Chrome; the pixel evidence is from before the change, on the cause this removes.

🤖 Generated with Claude Code

…ground beats

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the three previous background issues are addressed.

Summary

Drawn frames now get their default white background from a low-priority CSS rule rather than an inline style.

  • Drawn frames keep their white default but let designs choose backgrounds.

Reviews (2) · Last reviewed commit: "fix(canvas): recognise the old frame whi..." · Reviewed by Greptile

Comment thread shared/framePaper.ts Resolved
Comment thread shared/framePaper.ts Resolved
Comment thread shared/framePaper.ts Resolved
…t as a layered rule

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kgoedecke

Copy link
Copy Markdown
Collaborator Author

@greptileai

ArcticSlayy added a commit to ArcticSlayy/doop that referenced this pull request Nov 15, 2026
fix(canvas): make a drawn frame's white a default a design's own background beats (upstream doop-design#492)
kgoedecke added a commit that referenced this pull request Nov 16, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 3653221318ba04ef7e3064a4f72536d580fbca47)
@kgoedecke kgoedecke closed this Nov 21, 2026
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