Skip to content

Fix design-mode svg[fill="none"] leaking into host page (#181)#185

Open
pcamarajr wants to merge 1 commit into
benjitaylor:mainfrom
pcamarajr:fix/design-mode-svg-fill-scope
Open

Fix design-mode svg[fill="none"] leaking into host page (#181)#185
pcamarajr wants to merge 1 commit into
benjitaylor:mainfrom
pcamarajr:fix/design-mode-svg-fill-scope

Conversation

@pcamarajr
Copy link
Copy Markdown

Fixes #181.

What

Scope the svg[fill="none"] { fill: none !important } reset in design-mode/styles.module.scss under .overlay and .rearrangeOverlay instead of leaving it global.

Why

The unscoped rule overrides host page SVGs that use fill="none" with CSS-based fills (Tailwind fill-current, Lucide icons, shadcn radio dots, etc.) — exactly the regression #58 was meant to close. #136 scoped this protection in page-toolbar-css and annotation-popup-css but missed design-mode, so the leak still ships in v3.0.x.

How

Matches the existing pattern from #136 — nests the svg[fill="none"] (and :not([fill]) variant) under the two top-level design-mode wrappers. Verified in the compiled dist/index.mjs that the rule now compiles to .styles-module__overlay___… svg[fill=none], .styles-module__rearrangeOverlay___… svg[fill=none], mirroring css5 (toolbar) and css (popup).

No portals are used inside design-mode, so every SVG it renders sits under one of these two containers — coverage is complete.

How to test

  1. pnpm install && pnpm --filter agentation build
  2. pnpm --filter agentation test — 83 tests pass.
  3. Repro from Bug: Global svg[fill=none] rule in design-mode CSS leaks into host app (regression of #58) #181 (Radix RadioGroup + <Circle className="fill-current" />): the radio indicator renders as a filled dot again, not the empty double-ring.
  4. Inspect dist/index.mjs → no unscoped svg[fill=none] selectors remain.

The unscoped reset in design-mode/styles.module.scss leaked into host
page SVGs that rely on fill="none" with CSS-based fills (e.g. Tailwind
fill-current, Lucide icons). PR benjitaylor#136 fixed the same regression in
page-toolbar and annotation-popup but missed design-mode.

Scope the rule under `.overlay` and `.rearrangeOverlay` — the two
top-level wrappers that contain all design-mode SVGs — matching the
existing pattern.

Fixes benjitaylor#181
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@pcamarajr is attempting to deploy a commit to the Benji Taylor's Projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Bug: Global svg[fill=none] rule in design-mode CSS leaks into host app (regression of #58)

1 participant