Skip to content

fix(TreeSelect): apply ConfigProvider className/style and prevent popup style leak - #59343

Merged
QDyanbing merged 1 commit into
ant-design:featurefrom
dogledogle:fix/tree-select-root-class-style
Sep 23, 2026
Merged

QDyanbing merged 1 commit into
ant-design:featurefrom
dogledogle:fix/tree-select-root-class-style

Conversation

@dogledogle

Copy link
Copy Markdown
Contributor

🤔 这个变动的性质是?

  • 🆕 新特性提交
  • 🐞 Bug 修复
  • 📝 站点、文档改进
  • 📽️ 演示代码改进
  • 💄 组件样式/交互改进
  • 🤖 TypeScript 定义更新
  • 📦 包体积优化
  • ⚡️ 性能优化
  • ⭐️ 功能增强
  • 🌐 国际化改进
  • 🛠 重构
  • 🎨 代码风格优化
  • ✅ 测试用例
  • 🔀 分支合并
  • ⏩ 工作流程
  • ⌨️ 无障碍改进
  • ❓ 其他改动(是关于什么的改动?)

🔗 相关 Issue

fix #59329

按维护者评审建议,本 PR 替代 #59230 和 #59330,统一完成修复。

💡 需求背景和解决方案

ConfigProvider 的 treeSelect 全局 className / style 被静默忽略(#59329)——TreeSelect 未从组件配置读取这两个属性;同时根节点语义 classNames.root / styles.root 会泄漏到下拉弹层(v6 #53229 引入的遗留行为,Select 已移除而 TreeSelect 保留,导致 height、overflow 等根节点样式影响弹层)。

两个问题按维护者建议应基于 feature 分支统一修复,方案参照 Select:

  1. 消费组件配置的 className / style,经 useSemanticRootStyle 纳入语义合并,优先级保持 ConfigProvider styles.root → ConfigProvider style → 组件 styles.root → 组件 style;
  2. 弹层不再应用根节点语义样式,仅使用 popup.root。此前依赖 classNames.root / styles.root 影响弹层的写法不再生效(与 Select 对齐),请改用 rootClassName 或 popup.root。

已新增隔离与全局配置两处回归测试,并更新受影响的 demo 快照。

📝 更新日志

语言 更新描述
🇺🇸 英文 🐞 Fix TreeSelect ignoring ConfigProvider treeSelect className / style config and root classNames / styles leaking into popup.
🇨🇳 中文 🐞 修复 TreeSelect 未应用 ConfigProvider treeSelect 全局 className / style,且根节点语义样式泄漏到弹层的问题。

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 09467a53-565c-45b7-9286-850a8b0d468f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #59343 Passed ✅

🎯 Target branch: feature (d7e65da)
⚠️ Baseline may be stale: no snapshot for the PR's base commit was found, so an older branch snapshot was used. Some diffs below may come from changes already merged into feature rather than this PR.
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

📖 中文报告

👁 PR #59343 视觉回归报告 通过 ✅

🎯 目标分支: feature (d7e65da)
⚠️ 基线可能已过期: 未找到该 PR 基准提交对应的快照,因此回退使用了较旧的分支快照。下方部分差异可能来自已合并到 feature 的改动,而非本 PR。

🎊 恭喜!未发现视觉回归差异。

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Preview is ready

@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 62 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.26MB 62 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js 31 bytes 1.83MB 0.0%
antd.min.js 31 bytes 1.43MB 0.0%

@pkg-pr-new

pkg-pr-new Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
More templates

npm i https://pkg.pr.new/antd@59343

commit: 2ae8917

@codecov

codecov Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d7e65da) to head (2ae8917).
⚠️ Report is 12 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #59343   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          834       834           
  Lines        16136     16139    +3     
  Branches      4263      4264    +1     
=========================================
+ Hits         16136     16139    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@QDyanbing

Copy link
Copy Markdown
Member

LGTM,@zombieJ 帮忙看看。

@dogledogle
dogledogle force-pushed the fix/tree-select-root-class-style branch from 53b2bc7 to 2ae8917 Compare September 20, 2026 10:11

@nrps9909 nrps9909 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 2ae8917a9e729dbf97a81654eb776063a4a44663.

The change keeps TreeSelect root configuration on the trigger, isolates popup.root, and preserves the intended style priority across ConfigProvider semantic styles, ConfigProvider style, component semantic styles, and component style. I found no blocker.

Validation:

  • TreeSelect suite: 7 suites passed, 80 tests passed, 2 skipped, 45 snapshots passed
  • independent four-layer priority and popup-isolation probe passed
  • TypeScript, ESLint, and Biome passed
  • exact-head remote checks are green (with the expected package-version verification skip)

Independent review performed with OpenAI Codex assistance.

@meet-student meet-student left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文

LGTM。ConfigProvider 的 treeSelect.className/style 作用到选择器根节点,并且从 popup 上拿掉 mergedStyles.root,避免高度/overflow 漏到下拉层。这是正确修法。

注意:master 上还有功能重叠的 #59330,建议合入本 PR 后关闭另一条。

English

LGTM. ConfigProvider treeSelect.className/style now apply to the selector root, and mergedStyles.root is no longer copied onto the popup. That is the right fix.

Note: #59330 overlaps this on master. Close that one after this lands.

@QDyanbing
QDyanbing merged commit 9208ad9 into ant-design:feature Sep 23, 2026
41 checks passed
@dogledogle
dogledogle deleted the fix/tree-select-root-class-style branch September 23, 2026 02:23
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.

4 participants