Skip to content

feat[Input.Search]: Abandoning the use of addon * in the Search component#55705

Merged
zombieJ merged 9 commits intoant-design:nextfrom
EmilyyyLiu:next-Search-compact
Nov 14, 2025
Merged

feat[Input.Search]: Abandoning the use of addon * in the Search component#55705
zombieJ merged 9 commits intoant-design:nextfrom
EmilyyyLiu:next-Search-compact

Conversation

@EmilyyyLiu
Copy link
Contributor

🤔 This is a ...

  • 🛠 Refactoring

🔗 Related Issues

💡 Background and Solution

📝 Change Log

Language Changelog
🇺🇸 English Abandoning the use of addon * in the Search component, Replace with Compact
🇨🇳 Chinese Search组件废弃addon*的使用,用compact替换

@bolt-new-by-stackblitz
Copy link

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

👁 Visual Regression Report for PR #55705 Failed ❌

🎯 Target branch: next (0c6cd49)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 42 changed

Expected (Branch next) Actual (Current PR) Diff
auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png
auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png
auto-complete-certain-category.default.png auto-complete-certain-category.default.png auto-complete-certain-category.default.png auto-complete-certain-category.default.png
auto-complete-form-debug.compact.png auto-complete-form-debug.compact.png auto-complete-form-debug.compact.png auto-complete-form-debug.compact.png
auto-complete-form-debug.dark.png auto-complete-form-debug.dark.png auto-complete-form-debug.dark.png auto-complete-form-debug.dark.png
auto-complete-form-debug.default.png auto-complete-form-debug.default.png auto-complete-form-debug.default.png auto-complete-form-debug.default.png
auto-complete-uncertain-category.compact.png auto-complete-uncertain-category.compact.png auto-complete-uncertain-category.compact.png auto-complete-uncertain-category.compact.png
auto-complete-uncertain-category.dark.png auto-complete-uncertain-category.dark.png auto-complete-uncertain-category.dark.png auto-complete-uncertain-category.dark.png

Warning

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


Important

There are 42 diffs found in this PR: 🔄 42 changed.
Please check all items:

  • Checked all diffs in the full report
  • Visual diff is acceptable

@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

Preview is ready

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

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.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@meet-student meet-student requested a review from Copilot November 13, 2025 08:25
@EmilyyyLiu EmilyyyLiu changed the title Next search compact feat[Input.Search]: Abandoning the use of addon * in the Search component Nov 13, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @EmilyyyLiu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring effort within the Ant Design input components. The primary goal is to replace the use of deprecated addon* props in Input.Search and Input.Group with the more modern and flexible Space.Compact component. This modernization not only removes existing deprecation warnings but also standardizes component composition, leading to a cleaner, more maintainable, and future-proof codebase across various components that utilize these input types.

Highlights

  • Refactoring Input.Search: The Input.Search component has been refactored to abandon the use of addon* props, replacing them with the Space.Compact component for improved layout and consistency.
  • Input.Group Modernization: The Input.Group component now utilizes Space.Compact as its root element, aligning with current best practices and removing deprecated usage warnings.
  • Snapshot Updates: Numerous snapshot tests across auto-complete, button, input, space, and tree components have been updated to reflect the new DOM structure and class names introduced by the Space.Compact integration.
  • Deprecation Warning Removal: The changes eliminate deprecation warnings related to addonAfter usage in Input components, streamlining the codebase and improving maintainability.
  • New Styling for Search: A dedicated style file (style/search.ts) has been introduced for the Input.Search component, centralizing its specific styling rules.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @EmilyyyLiu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring initiative to modernize the Input.Search and Input.Group components. By transitioning from deprecated addon* props to the more flexible and recommended Space.Compact component, the changes aim to enhance the modularity, maintainability, and overall consistency of the UI components. The updates span across component logic, styling, and comprehensive test coverage to ensure a smooth migration and correct rendering.

Highlights

  • Refactoring Input.Search Component: The Input.Search component has been refactored to abandon the use of addon* props, replacing them with the Space.Compact component for improved composition and consistency.
  • Input.Group Migration: The Input.Group component now also leverages Space.Compact as its wrapper element, aligning with the deprecation of older grouping mechanisms.
  • Styling Adjustments: New styling logic has been introduced for Input.Search in a dedicated file (components/input/style/search.ts), and existing input group styles have been adjusted to work seamlessly with Space.Compact.
  • Snapshot and Test Updates: Numerous snapshot tests across auto-complete, button, input, space, and tree components have been updated to reflect the new DOM structure and class names resulting from the Space.Compact integration. Specific test cases for Input.Search's className behavior were also added.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant and well-executed refactoring of the Input.Search and Input.Group components to use Space.Compact. This change deprecates the use of addon* properties, which improves component consistency and maintainability across the library. The implementation is solid, with appropriate updates to component logic, styles, and tests to reflect the new structure. I've identified one minor area where a style rule appears to be redundant, but overall, this is a high-quality contribution that modernizes the input components.

Comment on lines +7 to +11
return {
[componentCls]: {
width: '100%',
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The width: '100%' style appears to be redundant. The Search component now uses Space.Compact with a hardcoded block prop. This block prop adds the .ant-space-compact-block class, which already applies width: 100%. To avoid redundancy and keep the styling logic clean, consider removing this style definition. If it's intended as a safeguard, adding a comment to explain its purpose would be beneficial for future maintenance.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the Input.Search component to abandon the deprecated addon* API and replace it with Space.Compact. The key changes include:

  • Restructured Input.Search to use Space.Compact as the root wrapper
  • Updated Input.Group to use Space.Compact internally
  • Added new style file for Search component
  • Modified styling to support the new compact layout
  • Updated tests and snapshots to reflect the new DOM structure

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
components/input/Search.tsx Refactored to wrap Input and button in Space.Compact instead of using addonAfter
components/input/Group.tsx Changed from <span> to <Space.Compact> wrapper
components/input/style/search.ts New style hook for Search component
components/input/style/index.ts Updated styles for compact layout, moved button styles, commented out z-index rules
components/input/__tests__/Search.test.tsx Added assertions for className placement, reordered imports
components/space/__tests__/space-compact.test.tsx Updated tests for Input.Search compact behavior
Multiple snapshot files Updated to reflect new DOM structure with Space.Compact

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Input.Search and Input.Group components to use Space.Compact instead of the deprecated addon* properties. While the refactoring is a good step forward, I've found a critical regression in the Input.Search component where the default search button and the addonAfter prop are no longer rendered correctly. The rest of the changes, including snapshot updates and style adjustments, look consistent with the refactoring goal.

Comment on lines +246 to +257
return (
<Space.Compact
className={mergedClassName}
style={{ ...style, ...mergedStyles.root }}
{...rootProps}
hidden={hidden}
block
>
<Input ref={composeRef<InputRef>(inputRef, ref)} {...inputProps} />
{button}
</Space.Compact>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This refactoring to use Space.Compact appears to have introduced two regressions from the previous behavior:

  1. addonAfter prop is ignored: The addonAfter prop is destructured but no longer rendered when enterButton is not present. This is a breaking change as it was previously supported.

  2. Default search button is missing: When enterButton is false, the search button is no longer rendered. The button variable is only defined within the if (enterButton) block, leaving it undefined for the default case. The previous implementation rendered a search icon button.

The test snapshots seem to reflect the expected (and previously working) behavior, but the code changes in this PR do not produce that output. This suggests the implementation is incomplete.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 13, 2025

@codecov
Copy link

codecov bot commented Nov 13, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
antd.min-array-push 3.77MB 1.38kB (0.04%) ⬆️

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 689 bytes 2.08MB 0.03%
antd.min.js 689 bytes 1.69MB 0.04%

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

  • ./components/input/style/index.ts → Total Size: 17.19kB

Files in antd.min.js:

  • ./components/input/style/index.ts → Total Size: 17.19kB

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1ab1da6) to head (b66b999).
⚠️ Report is 5 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #55705   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          800       801    +1     
  Lines        14770     14774    +4     
  Branches      3910      3909    -1     
=========================================
+ Hits         14770     14774    +4     

☔ View full report in Codecov by Sentry.
📢 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.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 14, 2025
@zombieJ zombieJ merged commit bbef6f8 into ant-design:next Nov 14, 2025
38 checks passed
@zombieJ zombieJ mentioned this pull request Nov 19, 2025
17 tasks
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.

3 participants