Skip to content

feat: unify allowClear configuration - #341

Merged
zombieJ merged 1 commit into
react-component:masterfrom
QDyanbing:feat-unify-allow-clear
Oct 13, 2026
Merged

zombieJ merged 1 commit into
react-component:masterfrom
QDyanbing:feat-unify-allow-clear

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

改动说明

将 @rc-component/input 的最低依赖版本升级为 ~1.4.1,并接入 @rc-component/util@^1.14.0 的 useAllowClear,统一 Mentions 的清除配置和布局判断。

allowClear={{ disabled: true }} 与 allowClear={false} 保持一致,移除清除按钮及其专用布局,同时保留显式后缀。通过新版 Input 继承 AllowClearConfig,支持自定义图标、label 和清除按钮 tabIndex,保留原有清空值及回调行为。

补充配置文档和回归测试,更新默认无障碍名称对应的快照。文档同时说明:没有其他后缀时动态关闭清除入口可能重建输入节点并失焦,与传入 false 一致。

相关讨论:ant-design/ant-design#59553

验证

  • 使用 npm 正式发布的 Input 1.4.1、util 1.14.0 验证。
  • 全量测试及覆盖率采集通过:58 项测试、6 个快照;新增布局判断已覆盖。
  • TypeScript 检查、lint、库编译通过。
  • Chromium 验证实际布局、动态切换、焦点与选区、Tab/Shift+Tab、鼠标点击及 Enter/Space 清除,运行时无报错。

Summary by CodeRabbit

  • 新功能
    • 清除按钮支持配置自定义图标、禁用状态、键盘导航顺序和可访问名称。
  • 问题修复
    • 禁用清除按钮或保留后缀时,输入框的焦点和选区可正常保留。
  • 文档
    • 补充清除按钮配置及动态禁用时可能出现的输入框行为说明。

@vercel

vercel Bot commented Oct 13, 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 Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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: e9185973-4ddf-468c-8312-4deb23bee182
📥 Commits

Reviewing files that changed from the base of the PR and between ffdd7ce and ee3e1fe.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/AllowClear.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • README.md
  • package.json
  • src/Mentions.tsx
  • tests/allowClear.test.tsx

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

Walkthrough

Mentions 现在通过 useAllowClear 读取清除配置,并据此判断是否需要后缀包装。新增测试覆盖禁用清除、自定义按钮属性、回调、焦点和选区。README 更新了配置类型及说明。

Changes

清除配置处理

层 / 文件 摘要
清除配置处理与验证
src/Mentions.tsx、tests/allowClear.test.tsx、package.json
Mentions 使用 useAllowClear 读取配置,并检查 clearConfig.disabled。新增测试覆盖禁用状态、自定义图标和按钮属性、清除回调,以及配置更新时输入框的焦点和选区。依赖版本约束也有更新。
清除配置文档
README.md
allowClear 的对象类型改为 AllowClearConfig。文档列出可选字段,并说明禁用状态、键盘导航、可访问名称及动态禁用时输入框可能发生的变化。

Priority: ⬇️ Low

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

Change: Feature

建议评审者: zombiej

Merge Risk: ⚪ Minimal · up to ee3e1

目前没有发现需要阻止合并的具体问题;完成常规检查后可以合并。

Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题“feat: unify allowClear configuration”准确概括了本次 PR 的主要变更,包括统一 allowClear 配置和相关行为。标题简洁且明确。
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
  • 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

兔子捧来一朵花,
清除按钮听配置的话。
图标、标签与焦点,
测试逐项轻轻查。
README 添上新说明,
长耳点头跳回家。

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

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.36%. Comparing base (ffdd7ce) to head (ee3e1fe).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #341   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files           8        8           
  Lines         305      306    +1     
  Branches       83       83           
=======================================
+ Hits          300      301    +1     
  Misses          5        5           

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

@zombieJ
zombieJ merged commit 32cf35e into react-component:master Oct 13, 2026
11 of 12 checks passed
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