Skip to content

fix(canvas): hide empty chrome for ambient styles - #263

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/ambient-selector-empty-container
Jul 24, 2026
Merged

fix(canvas): hide empty chrome for ambient styles#263
DavidBabinec merged 1 commit into
mainfrom
fix/ambient-selector-empty-container

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What changed

  • generate canvas-only placeholder suppression rules for authored ambient selectors
  • scope comma-separated selectors safely with :is(...)
  • preserve authored :empty semantics despite the editor-only placeholder child
  • ignore empty ambient entries and raw at-rules while covering context-only declarations

Why

ContainerEditor already removes its empty-state affordance when a node has a directly assigned class or inline styles. Ambient selectors such as .dots i attach through CSS matching and are therefore invisible to that component-level check. The authored empty element was correctly styled, but the striped “Empty container” chrome remained visible over it.

The fix lets the browser use the same ambient selector matching as the authored stylesheet and hides only the direct editor-placeholder child. Published markup is unchanged.

User impact

Empty decorative elements styled through descendant, sibling, attribute, state, selector-list, or :empty ambient rules now preview without Instatic’s empty-state chrome. The selectable canvas root remains intact.

Verification

  • bun test — 6,262 passed, 0 failed
  • bun run build
  • bun run lint
  • bunx tsc -b --noEmit
  • changed-file ESLint
  • focused canvas/container tests — 153 passed
  • local React Doctor diff scan — no task-specific regression; remote score API unavailable
  • browser E2E with disposable SQLite data:
    • created .dots parent and empty custom <i> child
    • applied .dots i ambient width, height, background, and radius
    • verified placeholder computes to display: none in mobile, tablet, and desktop canvas frames
    • verified save/reload persistence
    • published and verified the public <i> has no children and identical authored styling

@DavidBabinec
DavidBabinec marked this pull request as ready for review July 24, 2026 14:21
@DavidBabinec
DavidBabinec merged commit b105659 into main Jul 24, 2026
9 checks passed
@DavidBabinec
DavidBabinec deleted the fix/ambient-selector-empty-container branch July 24, 2026 14:22
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