Skip to content

refactor: use the shared non-nullable overlay guard - #546

Open
QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards
Open

QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:fix-react-node-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

说明

  • 将 overlay 的手写非空判断替换为 isNonNullable,保持 aria-describedby 的现有生成语义。
  • 补充零值、布尔、空字符串及 null/undefined 的无障碍属性测试。
  • 将 @rc-component/util 最低版本提升到 ^1.13.0。

验证

  • npm test -- --runInBand(37 项通过)
  • npm run tsc
  • 改动源码 ESLint 检查通过。

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • Bug 修复
    • Tooltip 在弹出层内容为 0、false 或空字符串时,仍会正确设置按钮的 aria-describedby;内容为 null 或 undefined 时则不设置。
  • 依赖更新
    • 更新了 @rc-component/util 的依赖版本。

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 922a1e5c-ef59-40a0-a856-69af2045d511

📥 Commits

Reviewing files that changed from the base of the PR and between 2d2edbb and 114c968.

📒 Files selected for processing (3)
  • package.json
  • src/Tooltip.tsx
  • tests/renderability.test.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.


Walkthrough

Tooltip 将 @rc-component/util 的依赖范围更新为 ^1.13.0,并使用 isNonNullable 判断是否为按钮设置 aria-describedby。新增测试覆盖多种 overlay 值。

Changes

Tooltip overlay 处理

Layer / File(s) Summary
aria-describedby 判断与验证
package.json, src/Tooltip.tsx, tests/renderability.test.tsx
依赖范围更新为 ^1.13.0。Tooltip 在弹出层打开且 overlay 非空时,将 mergedId 加入 aria-describedby。测试覆盖 0、false、空字符串、null 和 undefined。

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: zombiej

Merge Risk: ⚪ Minimal · up to 114c9

The refactor preserves when Tooltip adds aria-describedby, and the new cases cover nullish and falsy overlays. No merge-blocking issue is established; proceed with normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题“refactor: use the shared non-nullable overlay guard”准确概括了主要变更:使用共享的 isNonNullable 替换 overlay 的手写非空判断。标题简洁、明确,并与测试和依赖更新相关。
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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

兔子捧着小胡萝卜,
看见提示添上了标记。
零和 false 也留在名单,
空字符串轻轻点头,
null 与 undefined 安静退场。

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

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2d2edbb) to head (114c968).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #546   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           38        39    +1     
  Branches        15        15           
=========================================
+ Hits            38        39    +1     

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

This branch has not been deployed

No deployments
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.

1 participant