Skip to content

fix: align borderless Input and Select component heights#57014

Merged
afc163 merged 1 commit intoant-design:masterfrom
njlazzar-su:fix/borderless-input-select-height
Feb 24, 2026
Merged

fix: align borderless Input and Select component heights#57014
afc163 merged 1 commit intoant-design:masterfrom
njlazzar-su:fix/borderless-input-select-height

Conversation

@njlazzar-su
Copy link
Contributor

Summary

Fix inconsistent heights between borderless Input and Select components.

Problem

When using variant="borderless", the Input component is 2px shorter than the Select component:

  • Input borderless: Sets border: 'none', which removes the border entirely. Since paddingBlock is already calculated as (controlHeight - fontHeight) / 2 - lineWidth, the total height becomes controlHeight - 2 * lineWidth (e.g., 30px instead of 32px).
  • Select borderless: Keeps the border but makes it transparent (borderColor: transparent), so it still occupies space. Total height remains controlHeight (32px).

Fix

Compensate for the removed border by adding lineWidth back to the vertical padding (paddingBlock) of borderless Input. This ensures both components maintain a consistent height equal to controlHeight in borderless mode.

The fix covers all three sizes (default, small, large) and both bare input and affix-wrapper (input with prefix/suffix) variants.

Related Issues

Fixes #56609

Type of Change

  • 🐛 Bug Fix (non-breaking change which fixes an issue)

Testing

  • The change aligns borderless Input height with borderless Select height
  • All three sizes (sm, default, lg) are handled
  • Affix-wrapper (Input with prefix/suffix) size variants are also compensated
  • InputNumber (which reuses genBorderlessStyle) also benefits from this fix

When Input uses variant='borderless', it sets border: 'none' which removes
the border entirely, causing the total height to be 2px less than
controlHeight (since paddingBlock already subtracts lineWidth). Meanwhile,
Select borderless keeps a transparent border that still occupies space,
maintaining the full controlHeight.

This fix compensates for the removed border by adding lineWidth back to the
vertical padding of borderless Input, ensuring both Input and Select have
consistent heights (controlHeight) in borderless mode.

Fixes ant-design#56609
@bolt-new-by-stackblitz
Copy link

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @njlazzar-su, 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 resolves an inconsistency in component heights when using the borderless variant. Specifically, it ensures that Input components, which remove their border entirely in borderless mode, now maintain the same height as Select components, which keep a transparent border. This is achieved by adjusting the vertical padding of borderless Input components to account for the removed border, leading to a more uniform UI experience across different input types.

Highlights

  • Inconsistent Heights Fixed: Addressed the height discrepancy between borderless Input and Select components, where Input was 2px shorter due to border removal.
  • Padding Adjustment: Compensated for the removed border in borderless Input by adding lineWidth back to paddingBlock to maintain consistent total height.
  • Comprehensive Scope: Ensured the fix applies to all three sizes (default, small, large) and both bare input and affix-wrapper variants, including InputNumber.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
Activity
  • Identified and fixed an issue where borderless Input components were shorter than Select components.
  • Implemented a compensation mechanism for removed borders in borderless Input components.
  • Verified the fix aligns borderless Input height with borderless Select height.
  • Confirmed all three sizes (sm, default, lg) are correctly handled.
  • Ensured affix-wrapper (Input with prefix/suffix) size variants are also compensated.
  • Noted that InputNumber also benefits from this fix.
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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

👁 Visual Regression Report for PR #57014 Failed ❌

🎯 Target branch: master (375463e)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 12 changed

Expected (Branch master) Actual (Current PR) Diff
input-borderless-debug.compact.png input-borderless-debug.compact.png input-borderless-debug.compact.png input-borderless-debug.compact.png
input-borderless-debug.dark.png input-borderless-debug.dark.png input-borderless-debug.dark.png input-borderless-debug.dark.png
input-borderless-debug.default.png input-borderless-debug.default.png input-borderless-debug.default.png input-borderless-debug.default.png
input-number-variant.compact.png input-number-variant.compact.png input-number-variant.compact.png input-number-variant.compact.png
input-number-variant.dark.png input-number-variant.dark.png input-number-variant.dark.png input-number-variant.dark.png
input-number-variant.default.png input-number-variant.default.png input-number-variant.default.png input-number-variant.default.png
input-variant.compact.png input-variant.compact.png input-variant.compact.png input-variant.compact.png
input-variant.dark.png input-variant.dark.png input-variant.dark.png input-variant.dark.png

Warning

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


Important

There are 12 diffs found in this PR: 🔄 12 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 Feb 17, 2026

Preview is ready

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Summary by CodeRabbit

样式优化

  • 样式改进
    • 优化了无边框输入框组件的内边距显示,确保小号、默认和大号尺寸的视觉表现更加一致。

概述

修复 borderless 状态下 Input 组件不同尺寸的高度不一致问题,通过添加 paddingBlock 补偿移除 border 后的高度差异,确保各尺寸变体高度一致。

变更详情

文件 / 组件 总结
Input 样式变量调整
components/input/style/variants.ts
在 genBorderlessStyle 函数中为 borderless 状态添加 paddingBlock 补偿,计算值为 token.calc(token.paddingBlock).add(token.lineWidth).equal()。同时为小尺寸(sm)和大尺寸(lg)及其 affix-wrapper 变体应用对应的 paddingBlockSM 和 paddingBlockLG 值,确保各尺寸高度一致。

评估代码审查工作量

🎯 1 (Trivial) | ⏱️ ~5 分钟

代码精选诗

🐰 无边框的高度曾参差不齐,
padding 的魔法令其匀整如诗,
sm、lg 各尺寸齐声欢呼,
视觉和谐了,问题已消除!✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确地反映了PR的主要变更,即修复无边框Input和Select组件的高度不一致问题。
Description check ✅ Passed 描述详细说明了问题、解决方案和涉及的组件变体,与代码变更相关联。
Linked Issues check ✅ Passed PR通过调整borderless Input的paddingBlock来补偿移除的边框宽度,使其高度与borderless Select保持一致,完全满足issue #56609的要求
Out of Scope Changes check ✅ Passed 所有代码变更仅限于components/input/style/variants.ts中的genBorderlessStyle,目的是调整borderless样式的垂直填充,完全在scope内。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 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.

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 addresses an inconsistency in height between borderless Input and Select components. The fix correctly compensates for the removed border on the borderless Input by adding the lineWidth back to the vertical padding. This change is consistently applied across all sizes (default, small, and large) and for both standard inputs and those with prefixes or suffixes. The implementation is clear, targeted, and effectively resolves the visual bug.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 18, 2026

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (375463e) to head (ee5456a).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #57014   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          808       808           
  Lines        15045     15045           
  Branches      3962      3962           
=========================================
  Hits         15045     15045           

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

@codecov
Copy link

codecov bot commented Feb 18, 2026

Bundle Report

Changes will increase total bundle size by 530 bytes (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.36MB 530 bytes (0.02%) ⬆️

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 265 bytes 1.88MB 0.01%
antd.min.js 265 bytes 1.49MB 0.02%

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

  • ./components/input/style/variants.ts → Total Size: 10.93kB

Files in antd.min.js:

  • ./components/input/style/variants.ts → Total Size: 10.93kB

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 24, 2026
@afc163 afc163 merged commit e26d8c2 into ant-design:master Feb 24, 2026
41 checks passed
@github-actions
Copy link
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 链接)。

钉钉社区群二维码

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.

borderless的input和borderless的select高度不一样

2 participants