Skip to content

fix: overlay and content swapped on container elements#155

Open
x401om wants to merge 1 commit intofeature/ui_builder_5_mvpfrom
fix/overlay-content-swap
Open

fix: overlay and content swapped on container elements#155
x401om wants to merge 1 commit intofeature/ui_builder_5_mvpfrom
fix/overlay-content-swap

Conversation

@x401om
Copy link
Contributor

@x401om x401om commented Mar 20, 2026

Summary

  • background decoded from wrong key: Schema.Element.Properties decoded background overlays from .overlay key instead of .background, making the background property completely non-functional
  • Overlay/content swap on containers: For all container elements (stack, button, box, row, column, section, pager), the LIFO task stack planning order caused overlay and content results to be swapped during build — overlay got the content, and content got the overlay

Root cause

In planElement, content was planned before planElementProperties (overlay/background). Since tasks are processed LIFO, overlay was built first (result at bottom of result stack), then content (result on top). During buildElement, buildElementProperties popped from the top — getting content instead of overlay — and buildBox/etc. popped next — getting overlay instead of content.

Fix

  1. Schema.Element.Properties.swift:146 — changed .overlay.background for the background decoding key
  2. Schema.Element.swift:61-88 — swapped planning order: planElementProperties now comes before planBox/planStack/etc. for all 7 container element types

Test plan

  • Verify overlay badges render correctly on leaf elements (image, text) — should be unchanged
  • Verify overlay badges render correctly on container elements (box with content + overlay)
  • Verify background property works (renders behind the element)
  • Test with library/elements/overlay_badges.bundle in the Gallery app

🤖 Generated with Claude Code

Two bugs fixed:

1. Schema.Element.Properties: `background` was decoded from the
   `.overlay` key instead of `.background`, making the background
   property completely non-functional.

2. Schema.Element planElement: for container elements (stack, button,
   box, row, column, section, pager), overlay/background were planned
   after content. Since the task stack is LIFO, this caused overlay
   results to land below content results on the result stack. During
   build, buildElementProperties popped content (expecting overlay)
   and buildBox/buildStack/etc popped overlay (expecting content),
   swapping them. Fix: plan overlay/background before content.
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