Skip to content

fix: expose inherited disabled state on menu items - #901

Merged
zombieJ merged 1 commit into
masterfrom
fix/menu-item-inherited-aria-disabled
Nov 9, 2026
Merged

zombieJ merged 1 commit into
masterfrom
fix/menu-item-inherited-aria-disabled

Conversation

@yoyo837

@yoyo837 yoyo837 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Use the effective disabled state for a menu item's aria-disabled so assistive technology can announce items disabled through their parent menu.
  • Cover a menu being re-enabled while an explicitly disabled item stays disabled.

This complements #900 and addresses the inherited disabled state surfaced by ant-design/ant-design#59821.

Summary by CodeRabbit

  • 无障碍改进
    • 菜单整体禁用时,菜单项会正确标记为禁用;菜单恢复启用后,未单独禁用的菜单项也会相应更新状态。
  • 测试
    • 增加了对菜单禁用状态传递及显式禁用状态的验证。

Copilot AI balanced review requested due to automatic review settings November 9, 2026 06:11
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
menu Ready Ready Preview Nov 9, 2026 6:12am UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

菜单项的 aria-disabled 现在反映合并后的禁用状态,该状态包含菜单上下文和菜单项自身的禁用状态。新增测试覆盖菜单级禁用状态的传递、更新及显式禁用状态的保留。

Changes

菜单禁用状态

层 / 文件 摘要
禁用状态传递与验证
src/MenuItem.tsx, tests/Menu.spec.tsx
InternalMenuItem 使用 mergedDisabled 设置 aria-disabled。测试覆盖菜单级禁用状态的传递和更新,并验证单独禁用的菜单项仍保持禁用状态。

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

Change: Bug fix

Suggested reviewers: zombiej

Merge Risk: Minimal · up to 21567

No merge-blocking risk is identified in the supplied evidence.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题“fix: expose inherited disabled state on menu items”与变更内容一致。变更将 InternalMenuItem 的 aria-disabled 从仅反映自身 disabled 属性改为反映合并后的禁用状态 mergedDisabled,该状态包含菜单上下文的禁用状态。新增测试验证:Menu disabled 为 true 时,未单独设置禁用的菜…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Title check

Explanation

标题“fix: expose inherited disabled state on menu items”与变更内容一致。变更将 InternalMenuItem 的 aria-disabled 从仅反映自身 disabled 属性改为反映合并后的禁用状态 mergedDisabled,该状态包含菜单上下文的禁用状态。新增测试验证:Menu disabled 为 true 时,未单独设置禁用的菜单项带有 aria-disabled="true";Menu 切换为 false 后该项不再带有该属性,显式禁用的菜单项仍保留该属性。PR 目标也说明,目的是让辅助技术能够识别通过父菜单禁用的菜单项。标题准确概括了主要变更。

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

兔子轻敲菜单键,
禁用状态传到边。
aria 标记清晰见,
状态切换也同步。
小测试把细节验。

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 269e19ee-cc3d-4fb3-8d97-befafd3a03e8
Commits

Reviewing files that changed from the base of the PR and between 0335418 and 21567f9.

Files selected for processing: 2

  • src/MenuItem.tsx
  • tests/Menu.spec.tsx

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

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 21567f9.

@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.73%. Comparing base (0335418) to head (21567f9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #901   +/-   ##
=======================================
  Coverage   99.73%   99.73%           
=======================================
  Files          26       26           
  Lines         745      745           
  Branches      207      207           
=======================================
  Hits          743      743           
  Misses          2        2           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

❌ Deploy failed

PR preview ❌ Failed ❌ Failed
🔗 Preview https://react-component-menu-preview-pr-901.surge.sh (may be unavailable)
📝 Commit21567f9
🪵 LogsView logs
📋 Build log (last lines)
npm error     5 more (@typescript-eslint/utils, @typescript-eslint/utils, ...)
npm error   12 more (@eslint/compat, @eslint/js, ...)
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error node_modules/eslint-plugin-react
npm error   dev eslint-plugin-react@"^7.37.5" from the root project
npm error   eslint-plugin-react@"^7.32.2" from @umijs/fabric@4.0.1
npm error   node_modules/@umijs/fabric
npm error     @umijs/fabric@"^4.0.0" from rc-test@7.1.3
npm error     node_modules/rc-test
npm error       dev rc-test@"^7.1.3" from the root project
npm error
npm error Conflicting peer dependency: eslint@9.39.5
npm error node_modules/eslint
npm error   peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" from eslint-plugin-react@7.37.5
npm error   node_modules/eslint-plugin-react
npm error     dev eslint-plugin-react@"^7.37.5" from the root project
npm error     eslint-plugin-react@"^7.32.2" from @umijs/fabric@4.0.1
npm error     node_modules/@umijs/fabric
npm error       @umijs/fabric@"^4.0.0" from rc-test@7.1.3
npm error       node_modules/rc-test
npm error         dev rc-test@"^7.1.3" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /home/runner/.npm/_logs/2026-11-09T06_13_16_627Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2026-11-09T06_13_16_627Z-debug-0.log

🤖 Powered by surge-preview

@zombieJ
zombieJ merged commit 180d068 into master Nov 9, 2026
15 checks passed
@zombieJ
zombieJ deleted the fix/menu-item-inherited-aria-disabled branch November 9, 2026 08:06
aibayanyu20 added a commit to antdv-next/vue-components that referenced this pull request Nov 10, 2026
- ignore Enter on disabled menu items (react-component/menu#900)
- expose inherited disabled state via aria-disabled (react-component/menu#901)
- block interactions with disabled submenus (react-component/menu#902)

This branch was successfully deployed

1 active deployment
Preview — 21567f93 Deployed Nov 9, 2026 by vercel[bot]
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.

3 participants