Skip to content

fix(Splitter): localize collapse control labels - #58978

Merged
afc163 merged 2 commits into
ant-design:featurefrom
thlovey:fix/58971-splitter-collapse-a11y
Aug 17, 2026
Merged

afc163 merged 2 commits into
ant-design:featurefrom
thlovey:fix/58971-splitter-collapse-a11y

Conversation

@thlovey

@thlovey thlovey commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🤔 这个变动的性质是?

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

🔗 相关 Issue

fix #58971

💡 需求背景和解决方案

Splitter 折叠控件的无障碍名称此前固定为英文,导致非英文环境下屏幕阅读器仍朗读英文,并且自定义折叠图标无法覆盖控件名称。

本次改动为 Splitter 增加本地化的起始和结束面板名称,提供英文回退,并允许自定义图标通过 aria-label 覆盖默认名称。逻辑起始和结束含义在垂直布局及 RTL 模式下保持一致,不新增组件属性。

📝 更新日志

语言 更新描述
🇺🇸 英文 Localize Splitter collapse control accessible names and support custom icon labels
🇨🇳 中文 Splitter 折叠控件支持本地化无障碍名称及自定义图标标签

@bolt-new-by-stackblitz

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview is ready

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #58978 Failed ❌

🎯 Target branch: feature (82d6f78)
⚠️ 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 ↗︎
📊 Summary: 🔄 7 changed, 🆕 6 added

Expected (Branch feature) Actual (Current PR) Diff
float-button-group-menu.compact.png float-button-group-menu.compact.png float-button-group-menu.compact.png float-button-group-menu.compact.png
float-button-group-menu.dark.png float-button-group-menu.dark.png float-button-group-menu.dark.png float-button-group-menu.dark.png
float-button-group-menu.default.png float-button-group-menu.default.png float-button-group-menu.default.png float-button-group-menu.default.png
float-button-shape.compact.png float-button-shape.compact.png float-button-shape.compact.png float-button-shape.compact.png
float-button-shape.dark.png float-button-shape.dark.png float-button-shape.dark.png float-button-shape.dark.png
float-button-shape.default.png float-button-shape.default.png float-button-shape.default.png float-button-shape.default.png
float-button-tooltip.compact.png float-button-tooltip.compact.png float-button-tooltip.compact.png float-button-tooltip.compact.png
auto-complete-customize-clear-debug-hover.compact.png auto-complete-customize-clear-debug-hover.compact.png 🆕🆕🆕 Added 🆕🆕🆕

Warning

There are more diffs not shown in the table. Please check the Full Report for details.


Important

There are 13 diffs found in this PR: 🔄 7 changed, 🆕 6 added.
Please check all items:

  • Checked all diffs in the full report
  • Visual diff is acceptable
📖 中文报告

👁 PR #58978 视觉回归报告 失败 ❌

🎯 目标分支: feature (82d6f78)
⚠️ 基线可能已过期: 未找到该 PR 基准提交对应的快照,因此回退使用了较旧的分支快照。下方部分差异可能来自已合并到 feature 的改动,而非本 PR。
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 概览: 🔄 7 变更, 🆕 6 新增

期望 (分支 feature) 实际 (当前 PR) 差异
float-button-group-menu.compact.png float-button-group-menu.compact.png float-button-group-menu.compact.png float-button-group-menu.compact.png
float-button-group-menu.dark.png float-button-group-menu.dark.png float-button-group-menu.dark.png float-button-group-menu.dark.png
float-button-group-menu.default.png float-button-group-menu.default.png float-button-group-menu.default.png float-button-group-menu.default.png
float-button-shape.compact.png float-button-shape.compact.png float-button-shape.compact.png float-button-shape.compact.png
float-button-shape.dark.png float-button-shape.dark.png float-button-shape.dark.png float-button-shape.dark.png
float-button-shape.default.png float-button-shape.default.png float-button-shape.default.png float-button-shape.default.png
float-button-tooltip.compact.png float-button-tooltip.compact.png float-button-tooltip.compact.png float-button-tooltip.compact.png
auto-complete-customize-clear-debug-hover.compact.png auto-complete-customize-clear-debug-hover.compact.png 🆕🆕🆕 Added 🆕🆕🆕

[!WARNING]
还有更多差异未在表格中展示,请查看 完整报告 了解详情。


[!NOTE]
本 PR 共发现 13 处差异:🔄 7 变更, 🆕 6 新增。请在上方英文报告中勾选确认项以通过 CI 校验。

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: Pro Plus

Run ID: ce46637e-6f78-4860-ba21-ddf410c68571

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
📝 Walkthrough

Summary by CodeRabbit

  • 新功能

    • Splitter 折叠控制按钮支持多语言文本。
    • 支持分别配置起始面板和结束面板的本地化标签。
    • 自定义折叠图标可通过 aria-label 覆盖默认标签,提升无障碍体验。
  • 文档

    • 补充自定义折叠图标标签的使用说明。
  • 测试

    • 覆盖多语言、布局方向、RTL 及英文回退场景。

Walkthrough

Splitter 新增本地化配置。折叠控制使用当前语言的可访问名称。自定义图标的 aria-label 优先级更高。测试覆盖多语言、RTL、垂直布局和英文回退。

Changes

Splitter 本地化

Layer / File(s) Summary
Splitter 本地化契约和语言配置
components/splitter/interface.ts, components/locale/index.tsx, components/locale/*.ts
新增 SplitterLocale 接口和可选的 Locale.Splitter 配置。各语言 locale 提供起始面板与结束面板文本。
折叠控制名称接入
components/splitter/SplitBar.tsx
SplitBar 使用本地化标签生成折叠控制的 aria-label。自定义图标的 aria-label 覆盖默认标签。
行为验证和文档更新
components/splitter/__tests__/index.test.tsx, components/splitter/index.en-US.md, components/splitter/index.zh-CN.md
测试覆盖多语言、RTL、垂直布局、英文回退和自定义标签。文档说明自定义图标标签的覆盖行为。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: 🔵 Low · up to f6a2c

The change improves Splitter collapse-control accessibility labels, but the current head still leaves one locale without the new keys and uses a less suitable Catalan term. Users in those locales may hear English or less-clear labels; this is a bounded localization/accessibility issue that is mergeable with explicit owner follow-up.

Sequence Diagram(s)

sequenceDiagram
  participant SplitBar
  participant SplitterLocale
  participant CollapseControl
  SplitBar->>SplitterLocale: 获取起始或结束面板标签
  SplitBar->>CollapseControl: 设置自定义 aria-label 或本地化标签
  CollapseControl-->>SplitBar: 暴露可访问名称
Loading

Possibly related PRs

Suggested labels: lgtm

Suggested reviewers: li-jia-nan, afc163, meet-student

Poem

兔子轻敲折叠栏,
多语标签清晰响。
自定义名优先显,
RTL 纵横皆适用。
无障碍路径更明亮。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 变更满足 Issue #58971,涵盖本地化标签、英文回退、自定义 aria-label 覆盖及垂直和 RTL 布局语义。
Out of Scope Changes check ✅ Passed 所有代码、测试、文档和语言包变更均围绕 Splitter 折叠控件无障碍名称本地化目标。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed 标题准确概括了 Splitter 折叠控件标签本地化这一主要变更。
Description check ✅ Passed 描述与变更内容一致,说明了本地化无障碍名称、英文回退和自定义图标标签覆盖。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot added the lgtm This PR has been approved by a maintainer label Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 9.48kB (0.29%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.31MB 9.48kB (0.29%) ⬆️

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 9.04kB 1.84MB 0.49%
antd.min.js 442 bytes 1.47MB 0.03%

Files in antd-with-locales.min.js:

  • ./components/locale/hy_AM.ts → Total Size: 7.06kB

  • ./components/locale/en_US.ts → Total Size: 4.11kB

Files in antd.min.js:

  • ./components/locale/en_US.ts → Total Size: 4.11kB

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/locale/en_US.ts`:
- Around line 56-59: Update all official locale files, including frFR, with
Splitter.toggleStartPanel and Splitter.toggleEndPanel translations; in
components/locale/en_US.ts:56-59, treat the existing English entries as the
reference and add corresponding translated fields in each locale. In
components/splitter/__tests__/index.test.tsx:550-561, verify French labels for
frFR and move the English-fallback assertion to an explicit custom locale that
omits Splitter.

In `@components/splitter/__tests__/index.test.tsx`:
- Around line 563-582: Extend the “should use custom icon aria-labels for
collapse controls” test to pass a string value for collapsible.icon.end,
exercising the non-React-element branch of getAriaLabel. Keep the existing start
icon assertion and verify the end control still receives the localized label
“切換結束面板”.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e705357-1ac3-4678-b6ba-7c6e33edcf9b

📥 Commits

Reviewing files that changed from the base of the PR and between 2c71c89 and c381753.

📒 Files selected for processing (9)
  • components/locale/en_US.ts
  • components/locale/index.tsx
  • components/locale/zh_CN.ts
  • components/locale/zh_TW.ts
  • components/splitter/SplitBar.tsx
  • components/splitter/__tests__/index.test.tsx
  • components/splitter/index.en-US.md
  • components/splitter/index.zh-CN.md
  • components/splitter/interface.ts

Comment thread components/locale/en_US.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
More templates

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

commit: 804d17e

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (82d6f78) to head (804d17e).
⚠️ Report is 32 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #58978   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          834       834           
  Lines        15971     15981   +10     
  Branches      4197      4203    +6     
=========================================
+ Hits         15971     15981   +10     

☔ 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.

@thlovey
thlovey force-pushed the fix/58971-splitter-collapse-a11y branch from c381753 to f6a2cd6 Compare August 13, 2026 03:07
@yoyo837

yoyo837 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

feature branch please.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/locale/ca_ES.ts`:
- Around line 56-59: Update the Catalan Splitter translations in the Splitter
object, replacing “tauler” with “panell” in toggleStartPanel and toggleEndPanel
while preserving the requested wording: “Commuta el panell inicial” and “Commuta
el panell final”.

In `@components/locale/fa_IR.ts`:
- Around line 56-59: Update the locale definitions in es_US.ts to add
Splitter.toggleStartPanel and Splitter.toggleEndPanel, matching the existing
Splitter keys and providing appropriate Spanish translations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a16e1f0-9ca6-4b8d-8188-f4a48fd17730

📥 Commits

Reviewing files that changed from the base of the PR and between c381753 and f6a2cd6.

📒 Files selected for processing (70)
  • components/locale/ar_EG.ts
  • components/locale/az_AZ.ts
  • components/locale/bg_BG.ts
  • components/locale/bn_BD.ts
  • components/locale/by_BY.ts
  • components/locale/ca_ES.ts
  • components/locale/cs_CZ.ts
  • components/locale/da_DK.ts
  • components/locale/de_DE.ts
  • components/locale/el_GR.ts
  • components/locale/en_GB.ts
  • components/locale/es_ES.ts
  • components/locale/et_EE.ts
  • components/locale/eu_ES.ts
  • components/locale/fa_IR.ts
  • components/locale/fi_FI.ts
  • components/locale/fr_BE.ts
  • components/locale/fr_CA.ts
  • components/locale/fr_FR.ts
  • components/locale/ga_IE.ts
  • components/locale/gl_ES.ts
  • components/locale/he_IL.ts
  • components/locale/hi_IN.ts
  • components/locale/hr_HR.ts
  • components/locale/hu_HU.ts
  • components/locale/hy_AM.ts
  • components/locale/id_ID.ts
  • components/locale/is_IS.ts
  • components/locale/it_IT.ts
  • components/locale/ja_JP.ts
  • components/locale/ka_GE.ts
  • components/locale/kk_KZ.ts
  • components/locale/km_KH.ts
  • components/locale/kmr_IQ.ts
  • components/locale/kn_IN.ts
  • components/locale/ko_KR.ts
  • components/locale/ku_IQ.ts
  • components/locale/lt_LT.ts
  • components/locale/lv_LV.ts
  • components/locale/mk_MK.ts
  • components/locale/ml_IN.ts
  • components/locale/mn_MN.ts
  • components/locale/mr_IN.ts
  • components/locale/ms_MY.ts
  • components/locale/my_MM.ts
  • components/locale/nb_NO.ts
  • components/locale/ne_NP.ts
  • components/locale/nl_BE.ts
  • components/locale/nl_NL.ts
  • components/locale/pl_PL.ts
  • components/locale/pt_BR.ts
  • components/locale/pt_PT.ts
  • components/locale/ro_RO.ts
  • components/locale/ru_RU.ts
  • components/locale/si_LK.ts
  • components/locale/sk_SK.ts
  • components/locale/sl_SI.ts
  • components/locale/sq_AL.ts
  • components/locale/sr_RS.ts
  • components/locale/sv_SE.ts
  • components/locale/ta_IN.ts
  • components/locale/th_TH.ts
  • components/locale/tk_TK.ts
  • components/locale/tr_TR.ts
  • components/locale/uk_UA.ts
  • components/locale/ur_PK.ts
  • components/locale/uz_UZ.ts
  • components/locale/vi_VN.ts
  • components/locale/zh_HK.ts
  • components/splitter/__tests__/index.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/splitter/tests/index.test.tsx

Comment thread components/locale/ca_ES.ts Resolved
Comment thread components/locale/fa_IR.ts Resolved
@thlovey

thlovey commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

feature branch please.

好的

@thlovey
thlovey force-pushed the fix/58971-splitter-collapse-a11y branch from f6a2cd6 to f6ec9c3 Compare August 13, 2026 03:28
@thlovey
thlovey changed the base branch from master to feature August 13, 2026 03:28
Comment thread components/splitter/index.zh-CN.md Resolved
@thlovey
thlovey force-pushed the fix/58971-splitter-collapse-a11y branch from f6ec9c3 to 5a2c6f3 Compare August 13, 2026 03:40
@yoyo837

yoyo837 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

我个人看法仍然是除了中英文,其他语言等Native Speaker添加,先默认fallback到英文

@thlovey
thlovey force-pushed the fix/58971-splitter-collapse-a11y branch from 5a2c6f3 to 7c361d2 Compare August 13, 2026 03:56
@thlovey

thlovey commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

我个人看法仍然是除了中英文,其他语言等Native Speaker添加,先默认fallback到英文

haode

@QDyanbing

Copy link
Copy Markdown
Member

LGTM

@li-jia-nan

Copy link
Copy Markdown
Member

我个人看法仍然是除了中英文,其他语言等Native Speaker添加,先默认fallback到英文

以前没有 AI,我们是通过 Google translate 手动翻的,相比于母语者的翻译可能不够准确,只支持中英文做没啥问题,但是后面有了 AI,让 AI 翻的准确性大大提升了,每个语言都支持其实也是 OK 的

@thlovey

thlovey commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

我个人看法仍然是除了中英文,其他语言等Native Speaker添加,先默认fallback到英文

以前没有 AI,我们是通过 Google translate 手动翻的,相比于母语者的翻译可能不够准确,只支持中英文做没啥问题,但是后面有了 AI,让 AI 翻的准确性大大提升了,每个语言都支持其实也是 OK 的

那我再加一下

@thlovey
thlovey force-pushed the fix/58971-splitter-collapse-a11y branch from 7c361d2 to c8daecb Compare August 14, 2026 02:20

@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.

I reviewed the locale contract, fallback path, custom-icon precedence, and logical start/end behavior across horizontal, vertical, and RTL layouts.

Validation performed:

  • all 73 runtime locale modules expose non-empty toggleStartPanel and toggleEndPanel values (including es_US through its existing es_ES inheritance);
  • the focused Splitter Jest suite passes: 52 tests and 1 snapshot;
  • git diff --check passes;
  • the existing Vitest manifest intentionally excludes components/splitter/__tests__/index.test.tsx, so this focused suite is covered by Jest and the repository CI matrix.

The implementation resolves #58971 without adding a component prop, preserves the English fallback for partial custom locales, and keeps explicit custom icon aria-label values authoritative. I did not find an additional actionable issue.

@afc163
afc163 merged commit be8e187 into ant-design:feature Aug 17, 2026
41 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

钉钉社区群二维码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Splitter] Collapse controls expose hardcoded English accessible names

6 participants