fix(theme): restore Popover shadow with XProvider - #2030
Conversation
Why: antd 6 renders Popover elevation through the dropShadowPopover alias token. The XProvider token formatter did not expose that new alias, so its scoped CSS-variable class resolved --ant-drop-shadow-popover to an empty value and the Popover computed filter became none. What: add dropShadowPopover to the X alias-token contract and generate the same three-layer drop-shadow used by antd. Add a regression test that renders an antd Popover alongside an X component and verifies the scoped CSS variable contains a real drop-shadow value. Testing: focused XProvider/theme Jest suites, package TypeScript check, Biome, diff check, and browser comparison of the official reproduction against the patched local demo.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough新增 ChangesPopover 阴影令牌
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change restores the Popover shadow CSS variable for components sharing XProvider's theme context and includes regression coverage; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nrps9909
left a comment
There was a problem hiding this comment.
Reviewed exact head c840366 against base 25aad7b.
Blocking theme-algorithm mismatch: the new dropShadowPopover value is hardcoded to black, but the bundled antd 6.6.1 alias derives this token from mergedToken.colorShadow. That distinction is observable under theme.darkAlgorithm. Ant Design produces:
drop-shadow(... rgba(255,255,255,0.016)) ...
while this PRs XProvider CSS-variable class emits:
drop-shadow(... rgba(0, 0, 0, 0.08)) ...
I reproduced this by rendering Bubble plus an open Popover under XProvider theme={{ algorithm: theme.darkAlgorithm }}, locating the Popover css-var class, and comparing its --ant-drop-shadow-popover declaration with theme.getDesignToken({ algorithm: theme.darkAlgorithm }).dropShadowPopover. The exact-value assertion fails. The submitted test only checks that the declaration begins with drop-shadow(, so it passes despite replacing the dark-algorithm token with the default-light value.
Please derive the three alpha values from the merged colorShadow using the same alpha-preserving FastColor logic as antds current theme/util/alias, and add a dark-algorithm or exact-token regression. The default light value should remain unchanged.
Other validation on this exact head is clean: the submitted two-suite scope passes 4/4 tests; packages/x TypeScript noEmit passes; Biome passes all three changed files; git diff --check passes; live PR head still matches the tested SHA; remote checks are green.
AI assistance disclosure: Codex was used to inspect the exact diff and current bundled antd implementation, run the focused and static checks, construct the independent dark-token comparison, and draft this review. I verified the reported outputs.
🤔 This is a ...
🔗 Related Issues
Fixes #2021
💡 Background and Solution
Why
antd 6 renders Popover elevation with the
dropShadowPopoveralias token. XProvider's token formatter did not expose that newer alias. When X components generated a scoped CSS-variable class,--ant-drop-shadow-popoverwas missing, so Popover resolvedfiltertononeand lost its elevation.What
dropShadowPopoverto the X alias-token contractHow
The fix restores the missing CSS variable instead of adding a component-specific override, so Popover keeps using antd's own
filter: var(--ant-drop-shadow-popover)rule.🔎 Browser verification
Before — official 2.9.0 playground: the Popover is visible but its computed filter is
none.After — patched source: the Popover receives the three-layer drop shadow.
✅ Validation
tsc --noEmit -p packages/x/tsconfig.jsongit diff --checkfilter: nonebefore; three computeddrop-shadow(...)layers after📝 Change Log
Summary by CodeRabbit
样式改进
测试
🎬 Before / After browser recording
The same reproduction was run in the same browser viewport. Each GIF preview links to the original MP4.
Before — Popover shadow missing (filter: none)
Open the original before MP4
After — three-layer drop-shadow(...) restored
Open the original after MP4