8000
Skip to content

fix(ColorPicker): fix text clipping in ColorPicker InputNumber#55966

Merged
afc163 merged 1 commit intoant-design:masterfrom
DDDDD12138:fix-color-picker-input-number
Nov 28, 2025
Merged

fix(ColorPicker): fix text clipping in ColorPicker InputNumber#55966
afc163 merged 1 commit intoant-design:masterfrom
DDDDD12138:fix-color-picker-input-number

Conversation

@DDDDD12138
Copy link
Copy Markdown
Contributor

中文版模板 / Chinese template

🤔 This is a ...

  • 🐞 Bug fix

💡 Background and Solution

InputNumber components in ColorPicker inherit padding from Input base styles. When size="small" is used, the ant-input-number-sm class applies padding via CSS variables (var(--ant-input-number-padding-block-sm) and var(--ant-input-number-padding-inline-sm)), which is 7px horizontally. This causes text clipping in narrow input fields, especially the alpha channel input.

Preview

Before After
image image

📝 Change Log

Language Changelog
🇺🇸 English Fix text clipping in ColorPicker InputNumber components caused by inherited padding.
🇨🇳 Chinese 修复 ColorPicker 中 InputNumber 组件因继承 padding 导致的文字裁切问题

@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

@github-actions
Copy link
Copy Markdown
Contributor
github-actions bot commented Nov 27, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
Contributor
github-actions bot commented Nov 27, 2025

👁 Visual Regression Report for PR #55966 Passed ✅

🎯 Target branch: master (1b271fc)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @DDDDD12138, 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 a visual bug within the ColorPicker component where numerical input fields, particularly for alpha channel values, experienced text clipping. The issue stemmed from an inherited padding style that was too wide for the 'small' size variant of the InputNumber, causing content to be cut off. The change introduces a targeted style override to remove this problematic padding, ensuring all text is fully visible and improving the user experience of the ColorPicker.

Highlights

  • Bug Fix: Addresses text clipping in the ColorPicker's InputNumber components, specifically when size="small" is applied, which caused horizontal padding to be excessive.
  • Root Cause: The clipping was due to InputNumber components inheriting default padding from Input base styles, where var(--ant-input-number-padding-inline-sm) (7px horizontally) was applied, leading to narrow input fields.
  • Solution: The fix involves explicitly setting padding: 0 for the InputNumber components within the ColorPicker's styles to prevent the inherited padding from causing text truncation.
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.

@coderabbitai
Copy link
Copy Markdown
Contributor
coderabbitai bot commented Nov 27, 2025
📝 Walkthrough

Summary by CodeRabbit

发布说明

  • 样式优化
    • 调整了颜色选择器中输入框的内边距,优化视觉布局和外观。

✏️ Tip: You can customize this high-level summary in your review settings.

概览

在颜色选择器输入框样式中添加了 padding: 0 声明,移除了 .components-color-picker-steppers-ant-input-number 元素的默认内边距。仅涉及样式修改,无功能逻辑变更。

变更

内聚体 / 文件 变更摘要
颜色选择器输入框样式更新
components/color-picker/style/input.ts
.components-color-picker-steppers-ant-input-number 选择器添加 padding: 0,消除输入数字框的默认间距

估计代码审查工作量

🎯 1 (微不足道) | ⏱️ ~3 分钟

  • 单个样式声明修改,范围局限且无逻辑复杂性

🐰 一只兔子的数字诗

填充去无踪,✨
框框更紧凑,
选色更爽快,
数字贴边角!
小改精致妙。🎨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了主要改动:修复 ColorPicker 中 InputNumber 的文字裁切问题,与代码变更完全匹配。
Description check ✅ Passed 描述详细说明了 bug 的根本原因、解决方案,并包含对比图片和多语言 changelog,充分相关。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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
Copy Markdown
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 a text clipping issue in the ColorPicker's InputNumber components, which occurs due to inherited padding. The fix correctly removes this padding from the InputNumber wrapper by setting padding: 0. This is a targeted and effective solution for the visual bug. The change is correct and looks good.

Copy link
Copy Markdown
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/color-picker/style/input.ts (1)

31-31: 为 ColorPicker 中的 InputNumber 清空内边距是合理的

在 steppers 容器下对 ${antCls}-input-number 设置 padding: 0,可以有效去掉来自小号 InputNumber 的默认水平内边距,避免窄宽度(特别是 alpha 输入框)中文字被裁剪,且 0 作为“无间距”值不需要额外 token,符合当前设计体系。

可以作为一个可选优化考虑:如果未来希望仍保留或通过 token 控制垂直方向内边距,可以改成只清除水平方向,例如使用 paddingInline: 0,把 block 方向的控制留给尺寸相关样式。当前实现功能上没有问题,只是未来演进时的灵活性建议。(参考项目编码规范与已记录的 design token 使用习惯)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0be4d1b and 2a9d3f7.

📒 Files selected for processing (1)
  • components/color-picker/style/input.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always use TypeScript with strict type checking
Never use any type - define precise types instead
Use interfaces (not type aliases) for object structures
Export all public interface types
Prefer union types over enums, use as const for constants
Use early returns to improve readability
Support tree shaking
Follow import order: React → dependencies → antd components → custom components → types → styles
Prefer antd built-in components over external dependencies
Pass all ESLint and TypeScript checks
No console errors or warnings

**/*.{ts,tsx}: Use camelCase for property names
All components and functions must provide accurate type definitions
Avoid using any type, define types as precisely as possible
Use interface rather than type alias for defining object structures
All TypeScript should compile without errors or warnings
Use generics appropriately to enhance type flexibility
Use intersection types (&) to merge multiple types
Use literal union types to define limited option sets
Avoid using enum, prefer union types and as const
Rely on TypeScript's type inference as much as possible
Use type assertions (as) only when necessary
Complex data structures should be split into multiple interface definitions
Avoid outdated APIs and keep updated to new recommended usage

Files:

  • components/color-picker/style/input.ts
components/**/style/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

components/**/style/*.ts: Use @ant-design/cssinjs for all styling
Generate styles with functions named gen[ComponentName]Style
Use design tokens from the Ant Design token system
Support both light and dark themes
Use CSS logical properties for RTL support (e.g., margin-inline-start instead of margin-left)
Respect prefers-reduced-motion for animations

Files:

  • components/color-picker/style/input.ts
components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Never hardcode colors, sizes, or spacing values

components/**/*.{ts,tsx}: Use TypeScript and React for component development
Use functional components and hooks, avoid class components
Use PascalCase for component names
Use complete names rather than abbreviations in component naming
Initialize properties should use default + PropName naming pattern
Panel opening should use open prop instead of visible
Event handlers should follow on + EventName naming pattern
Child component events should follow on + SubComponentName + EventName naming pattern
Components should provide a ref attribute with nativeElement and focus methods
Export all public interface types for user convenience
Component props should use interface definition named ComponentNameProps
Use CSS transitions for simple animations, rc-motion for complex animations
Respect user's prefers-reduced-motion setting for animations
Follow WCAG 2.1 AA level accessibility standards for styling
Achieve 100% test coverage
Use useLocale hook from components/locale/index.tsx to get localization configuration
Use React.memo, useMemo, and useCallback appropriately for performance optimization
Use React.ForwardRefRenderFunction for component ref types
Callback function types should have explicit parameter and return value definitions
Component state should have dedicated interfaces (e.g., ComponentNameState)
Components should display well on different screen sizes (responsive design)
Components should support right-to-left (RTL) reading direction
Support page zoom to 200% with normal layout
Avoid animations that cause flickering
Ensure code runs normally with no console errors
Avoid unnecessary re-renders
Support Tree Shaking for bundle optimization

Files:

  • components/color-picker/style/input.ts
**/*.{ts,tsx,md}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use 2-space indentation

Files:

  • components/color-picker/style/input.ts
**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Maintain cross-browser compatibility

Files:

  • components/color-picker/style/input.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js}: Use early returns to improve code readability
Pass all ESLint and TypeScript checks

Files:

  • components/color-picker/style/input.ts
components/**/style/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Component Token naming format should follow: variant (optional) + semantic part + semantic part variant (optional) + css property + size/disabled (optional)

Files:

  • components/color-picker/style/input.ts
components/**/style/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

components/**/style/**/*.{ts,tsx}: Use @ant-design/cssinjs as the styling solution
Style generation functions should follow gen[ComponentName]Style naming convention
Use CSS-in-JS with performance considerations, avoid unnecessary style recalculation
Use class selectors instead of tag selectors for style overrides to improve specificity
Use CSS logical properties (margin-inline-start) instead of directional properties (margin-left) for RTL support
Ensure sufficient color contrast and do not rely on color alone to convey information
Components should use global Tokens and component-level Tokens for styling
Avoid hardcoding colors, sizes, spacing values; use design Tokens instead
Component-level Token naming should follow: Component + property name (e.g., buttonPrimaryColor)
Token modifications should cascade downward to ensure design system consistency
All components must support dark mode
Provide clear visual indication for focus state

Files:

  • components/color-picker/style/input.ts
🧠 Learnings (5)
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Avoid hardcoding colors, sizes, spacing values; use design Tokens instead

Applied to files:

  • components/color-picker/style/input.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Provide clear visual indication for focus state

Applied to files:

  • components/color-picker/style/input.ts
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/style/*.ts : Use `ant-design/cssinjs` for all styling

Applied to files:

  • components/color-picker/style/input.ts
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/style/**/*.{ts,tsx} : Use `ant-design/cssinjs` as the styling solution

Applied to files:

  • components/color-picker/style/input.ts
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/**/*.{ts,tsx} : Never hardcode colors, sizes, or spacing values

Applied to files:

  • components/color-picker/style/input.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: visual-diff snapshot (1/2)
  • GitHub Check: visual-diff snapshot (2/2)
  • GitHub Check: test-react-latest (dom, 1/2)
  • GitHub Check: test lib/es module (es, 2/2)
  • GitHub Check: test-react-latest (dom, 2/2)
  • GitHub Check: test-node
  • GitHub Check: test lib/es module (es, 1/2)
  • GitHub Check: test-react-legacy (18, 1/2)
  • GitHub Check: test-react-legacy (18, 2/2)
  • GitHub Check: build
  • GitHub Check: lint
  • GitHub Check: build
  • GitHub Check: build preview
  • GitHub Check: size

@pkg-pr-new
Copy link
Copy Markdown
pkg-pr-new bot commented Nov 27, 2025

@codecov
Copy link
Copy Markdown
codecov bot commented Nov 28, 2025

Bundle Report

Changes will decrease total bundle size by 8.23MB (-67.92%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.89MB -8.23MB (-67.92%) ⬇️

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 (New) 2.14MB 2.14MB 100.0% 🚀
antd.min.js (New) 1.75MB 1.75MB 100.0% 🚀
antd-with-locales.js (Deleted) -6.37MB 0 bytes -100.0% 🗑️
antd.js (Deleted) -5.75MB 0 bytes -100.0% 🗑️

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 28, 2025
@codecov
Copy link
Copy Markdown
codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@fadc5d0). Learn more about missing BASE report.
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##             master    #55966   +/-   ##
==========================================
  Coverage          ?   100.00%           
==========================================
  Files             ?       803           
  Lines             ?     14812           
  Branches          ?      3913           
==========================================
  Hits              ?     14812           
  Misses            ?         0           
  Partials          ?         0           

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

@afc163 afc163 merged commit d2251f2 into ant-design:master Nov 28, 2025
41 checks passed
@PeachScript PeachScript mentioned this pull request Dec 2, 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.

2 participants

0