Skip to content

refactor(ui): share the popup surface as popupSurface - #157

Merged
aayushbtw merged 2 commits into
ui-sdkfrom
refactor/popup-surface-style
Nov 21, 2026
Merged

aayushbtw merged 2 commits into
ui-sdkfrom
refactor/popup-surface-style

Conversation

@aayushbtw

Copy link
Copy Markdown
Owner

Why

Goal: every popup that draws the raised popup surface should take it from one shared style, as the popups already take their motion from popupMotion. Before this change, seven popups each wrote out the same three values: the raised fill, lg corners and the lg shadow. A later change to the surface had to find all seven. This closes the tracker row "Popup surfaces repeat one style". The look does not change.

What changed

  • popupSurface.base in packages/ui/src/lib/constella/styles.ts, beside popupReset, holds the fill, the four lg corners and the lg shadow.
  • These popups apply it before their own styles and drop their copies: Popover, Hover Card, Select, Combobox and Dropdown Menu.
  • Popover's exported popoverStyles.surface carries it, so Date Range Picker and Model Picker's details keep the surface without an edit.
  • Prompt Input's menu and Model Picker's command took the fill and corners from Command and the shadow locally. Both now apply popupSurface.base, and their local boxShadow is gone. Command is unchanged.
  • docs/ARCHITECTURE.md lists popupSurface among the styles.ts exports and adds a bullet on who applies it.

Scope

Left as they are, because they deliberately differ:

  • Tooltip uses the inverted fill and sm corners.
  • Dialog and Sheet use xl corners and the xl shadow.
  • Command, used inline, has no shadow.
  • Toast, the chart tooltip and the Data Table action bar use md corners. Side Panel uses shadows.panel.

Out of scope: Select, Combobox, Dropdown Menu and Date Range Picker each repeat a reset of the browser's [popover] border. The resets differ per part (margin, padding), so they stay out of the surface.

Tradeoffs

  • styles.ts, not motion.ts. ARCHITECTURE puts shared styles in styles.ts and motion in motion.ts, and popupReset already lives there. The advisor picked this placement and the name popupSurface.base, which mirrors popupReset.base.
  • Laziness Protocol: consolidate the decision. The surface is now decided in one place. The change only moves existing declarations and adds no new layer.
  • Prove It Works: scripted the check against the rendered site rather than relying on the type check. Details below.

Blast Radius

Every anchored popup's class list changes. StyleX atoms are hashed by property and value, so each popup gets the same atomic classes as before.

Verification

  • Ran vpr check and vpr test on the rebased head. Both pass (543 tests passed, 1 expected fail).
  • Pixel proof, on a headless dev server at a free port. A script opened every popup trigger in the demos for Popover, Hover Card, Select, Combobox, Dropdown Menu, Date Range Picker, Model Picker and Prompt Input, in light and dark. It shot the viewport after motion settled. It ran first on origin/ui-sdk at 446959e and then on this change rebased onto it. The final rebase onto 75d1153 applied with no conflict and touched none of these lines.
    • Result: 96 of 96 shots matched byte for byte. Computed fill, radii, shadow, border, padding, margin and size also matched.
    • Noise floor: two baseline runs gave 0 of 94 differing.
    • The served Select content carried styles__popupSurface.base, so the "after" run used the new code.
  • Prompt Input's / menu does not open in the browser on this branch (see below). A throwaway jsdom test opened it through @ui-sdk/core/testing and compared the content's atomic classes before and after. All 29 matched.

Found and not fixed (out of scope): on the docs page, typing / as the first character of the Prompt Input command demo is swallowed, so the menu never opens. Text typed after it lands. This happens on origin/ui-sdk without this change, and still happens after #153. The jsdom tests still pass.

Popover, Hover Card, Select, Combobox, Dropdown Menu, Prompt Input's menu and Model Picker's command each wrote out the raised fill, lg corners and lg shadow. popupSurface.base in styles.ts now holds them, beside popupReset, and each popup applies it before its own styles.
@aayushbtw

Copy link
Copy Markdown
Owner Author

Verdict: PASS+NOTES at 45c905c (code verified at 72e9140). check and 543 tests green; 104 popup shots light/dark, 0 px and 0 computed-style differences vs parent on dev and production builds; style order unchanged. Fix round made the ARCHITECTURE popupSurface bullet exact for Model Picker. Note: Prompt Input's / menu doesn't open on the dev server at parent or head (works in production); pre-existing.

@aayushbtw
aayushbtw merged commit 6d8aaea into ui-sdk Nov 21, 2026
1 check passed
@aayushbtw
aayushbtw deleted the refactor/popup-surface-style branch November 21, 2026 11:43
aayushbtw added a commit that referenced this pull request Nov 21, 2026
Moves the 11 resolved open follow-ups into the Review fixes table with their PRs (#137-#147, #157), adds the 9 follow-ups those PRs found, marks the swap-icon cleanup done by #143, and logs the batch.
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