Skip to content

fix(Progress): use percent for aria-valuenow instead of success percent - #59634

Merged
zombieJ merged 1 commit into
ant-design:masterfrom
Enesuygurs:fix/progress-aria-valuenow
Oct 23, 2026
Merged

zombieJ merged 1 commit into
ant-design:masterfrom
Enesuygurs:fix/progress-aria-valuenow

Conversation

@Enesuygurs

Copy link
Copy Markdown
Contributor

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

No linked issue.

💡 Background and Solution

When success is set, the role="progressbar" element reports the success segment as its value instead of the overall progress:

<Progress percent={60} success={{ percent: 30 }} />
// bar is 60% filled and the text says "60%", but aria-valuenow="30"

aria-valuenow reuses percentNumber, which prefers success.percent because it is used to decide the success status. It is also not clamped, so percent={120} gives aria-valuenow="120" (above aria-valuemax="100"), and negative values are reported as negative.

This PR sets aria-valuenow to validProgress(percent), the same value the default info text shows. The status logic is unchanged.

The snapshot updates only touch aria-valuenow:

  • the segment demo and the success-color cases now report 60 instead of 30;
  • out-of-range cases are clamped to 0/100;
  • the gradient-line demo reports 99.9 (matching its 99.9% text) instead of 99.

The new test fails on master (aria-valuenow="30") and passes with the change.

  • components/progress: 7 suites, 105 tests and 75 snapshots pass.
  • components/upload: 10 suites pass, with no snapshot changes.
  • ESLint, Biome and tsc --noEmit pass.

📝 Change Log

Language Changelog
🇺🇸 English 🐞 Fix Progress aria-valuenow reporting success.percent instead of percent and exceeding the 0–100 range.
🇨🇳 Chinese 🐞 修复 Progress 的 aria-valuenow 取值为 success.percent 而非 percent,以及超出 0–100 范围的问题。

@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 Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #59634 Passed ✅

🎯 Target branch: master (f8f5595)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

📖 中文报告

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

🎯 目标分支: master (f8f5595)

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

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Preview is ready

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4544c49-6df0-4ee9-a56f-cd90a7744400
📥 Commits

Reviewing files that changed from the base of the PR and between f8f5595 and b2fdc4a.

⛔ Files ignored due to path filters: 3
  • components/progress/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • components/progress/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap
  • components/progress/__tests__/__snapshots__/index.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing: 2
  • components/progress/__tests__/index.test.tsx
  • components/progress/progress.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug 修复
    • 修正进度条的无障碍进度值:即使显示成功百分比,aria-valuenow 也反映主进度,并限制在 0 到 100 之间。

Progress 根元素的 aria-valuenow 现在使用经 validProgress 处理的主百分比。新增测试覆盖默认和圆形进度条,以及主百分比超出范围的情况。

Changes: Progress 无障碍属性

层 / 文件 摘要
修正无障碍数值并验证边界
components/progress/progress.tsx, components/progress/__tests__/index.test.tsx
根元素的 aria-valuenow 改用经过 validProgress 处理的主百分比。测试验证默认和圆形进度条使用主百分比,并验证超出范围时的值。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b2fdc

The accessibility value correction is covered by the updated tests and is ready to merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed 标题准确概括了主要修改:修复 Progress 的 aria-valuenow 使用 success.percent,而不是主 percent。
Description check Passed 描述与变更相关。它说明了 aria-valuenow 的问题、修复方案、测试覆盖范围和验证结果。
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026

Copy link
Copy Markdown
More templates

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

commit: b2fdc4a

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will decrease total bundle size by 43.82kB (-1.33%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.24MB -43.82kB (-1.33%) ⬇️

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 -33.62kB 1.81MB -1.82%
antd.min.js -10.2kB 1.43MB -0.71%

@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f8f5595) to head (b2fdc4a).

Additional details and impacted files
@@             Coverage Diff             @@
##            master    #59634     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files          835       833      -2     
  Lines        17829     16071   -1758     
  Branches      4918      4213    -705     
===========================================
- Hits         17829     16071   -1758     

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

@zombieJ
zombieJ merged commit b727d6c into ant-design:master Oct 23, 2026
44 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 链接)。

钉钉社区群二维码

@coderabbitai coderabbitai Bot mentioned this pull request Oct 25, 2026
1 task done
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.

2 participants