Skip to content

fix: Select input cursor unexpectedly appearing in non search mode#56067

Merged
afc163 merged 2 commits intomasterfrom
fix/add-transparent-caret-color-to-readonly-input
Dec 4, 2025
Merged

fix: Select input cursor unexpectedly appearing in non search mode#56067
afc163 merged 2 commits intomasterfrom
fix/add-transparent-caret-color-to-readonly-input

Conversation

@afc163
Copy link
Member

@afc163 afc163 commented Dec 4, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

close #55856

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English Fix Select input cursor displayed in non search mode.
🇨🇳 Chinese 修复 Select 非搜索状态下显示输入光标的问题。

@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 Dec 4, 2025

Preview is ready

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 4, 2025

Deploying ant-design-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a21905
Status: ✅  Deploy successful!
Preview URL: https://bbd976eb.ant-design-next.pages.dev
Branch Preview URL: https://fix-add-transparent-caret-co.ant-design-next.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

👁 Visual Regression Report for PR #56067 Passed ✅

🎯 Target branch: master (263548e)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @afc163, 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 addresses a minor but noticeable visual bug in the Select component. Previously, a text caret would appear in the input field even when it was in a read-only state and not actively being used for search, leading to a confusing user experience. The change ensures that the caret is hidden in these specific scenarios, providing a cleaner and more intuitive interface for users interacting with the Select component.

Highlights

  • UI Bug Fix: Resolves an issue where a visible caret (text cursor) was incorrectly displayed in read-only input fields within the Select component, specifically when not in search mode.
  • Styling Adjustment: Implements the fix by adding "caretColor: 'transparent'" to the CSS rules for "input[readonly]" elements within the Select component's styling.
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
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Summary by CodeRabbit

  • 样式改进
    • 优化了只读状态下输入框的光标显示效果,提升了界面的视觉一致性和用户体验。

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

Walkthrough

components/select/style/select-input.ts 中为只读输入框选择器添加 caretColor: 'transparent' 属性,使得只读状态下的文本光标保持不可见。

Changes

样式调整 / 文件 变更摘要
光标可见性修复
components/select/style/select-input.ts
input[readonly] 选择器添加 caretColor: 'transparent',隐藏只读输入框的文本光标

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • 单文件修改,仅涉及一个CSS属性的添加
  • 修改为纯样式调整,无逻辑变更

Poem

一只兔子轻轻挥手,✨
光标啊光标,淡去又无踪,
Select 框里,只读的宁静,
美观流畅,用户心欢喜!🐰

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地总结了主要变更:修复Select组件在非搜索模式下意外显示光标的问题,与代码变更相符。
Description check ✅ Passed 描述相关性良好,明确标注为Bug修复,附带了相关Issue链接和中英文变更日志,准确反映了代码变更的目的。
Linked Issues check ✅ Passed 代码变更通过在readonly输入框中添加透明光标颜色解决了Issue #55856中描述的Select组件意外显示光标的问题。
Out of Scope Changes check ✅ Passed 所有变更均在范围内,仅涉及Select组件样式文件中的单一修改,直接针对Issue #55856中描述的问题。
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
  • Commit unit tests in branch fix/add-transparent-caret-color-to-readonly-input

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 263548e and 8a21905.

📒 Files selected for processing (1)
  • components/select/style/select-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/select/style/select-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/select/style/select-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/select/style/select-input.ts
**/*.{ts,tsx,md}

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

Use 2-space indentation

Files:

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

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

Maintain cross-browser compatibility

Files:

  • components/select/style/select-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/select/style/select-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/select/style/select-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/select/style/select-input.ts
🧠 Learnings (3)
📓 Common learnings
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
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 class selectors instead of tag selectors for style overrides to improve specificity
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} : Ensure sufficient color contrast and do not rely on color alone to convey information
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 : Support both light and dark themes
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/**/*.{ts,tsx} : Follow WCAG 2.1 AA level accessibility standards for styling
📚 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/select/style/select-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} : Ensure sufficient color contrast and do not rely on color alone to convey information

Applied to files:

  • components/select/style/select-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). (13)
  • GitHub Check: test-react-legacy (18, 2/2)
  • GitHub Check: test lib/es module (es, 2/2)
  • GitHub Check: test lib/es module (es, 1/2)
  • GitHub Check: build
  • GitHub Check: build preview
  • GitHub Check: visual-diff snapshot (2/2)
  • GitHub Check: visual-diff snapshot (1/2)
  • GitHub Check: test-react-legacy (18, 1/2)
  • GitHub Check: test-react-latest (dom, 2/2)
  • GitHub Check: test-react-latest (dom, 1/2)
  • GitHub Check: build
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages: ant-design-next
🔇 Additional comments (1)
components/select/style/select-input.ts (1)

183-187: 只读输入光标隐藏方案合理且作用范围正确

在只读 input 上增加 caretColor: 'transparent',只影响 input[readonly],可以去除非搜索模式下多余的文本光标,又不会影响搜索模式下可编辑输入框的插入符显示;焦点样式仍由外层 Select 的边框与阴影控制,符合“保持清晰焦点指示”的要求。旧浏览器若不支持 caret-color 也只是回退到当前行为,兼容性风险可接受。
Based on learnings, ...


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 a visual bug in the Select component where a text cursor (caret) was displayed in the input field even when it was not searchable. The fix involves setting caretColor: 'transparent' for readonly inputs within the select component. This is a clean and effective solution that correctly hides the caret, improving the user experience by removing a misleading visual cue. The change is minimal, targeted, and I see no issues with it. Well done.

@afc163 afc163 changed the title fix: add transparent caret color to readonly input in select component fix: Select input cursor displayed in non search mode Dec 4, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 4, 2025

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a21905
Status: ✅  Deploy successful!
Preview URL: https://c2a46b2e.ant-design.pages.dev
Branch Preview URL: https://fix-add-transparent-caret-co.ant-design.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

size-limit report 📦

Path Size
dist/antd.min.js 527.07 KB (+7 B 🔺)
dist/antd-with-locales.min.js 620.08 KB (+7 B 🔺)

@afc163 afc163 changed the title fix: Select input cursor displayed in non search mode fix: Select input cursor unexpectedly appearing in non search mode Dec 4, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 4, 2025

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 4, 2025

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #56067   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          803       803           
  Lines        14831     14831           
  Branches      3916      3916           
=========================================
  Hits         14831     14831           

☔ 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 Dec 4, 2025
@afc163 afc163 merged commit de4416b into master Dec 4, 2025
50 checks passed
@afc163 afc163 deleted the fix/add-transparent-caret-color-to-readonly-input branch December 4, 2025 05:05
@codecov
Copy link

codecov bot commented Dec 4, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
antd.min-array-push 3.89MB 50 bytes (0.0%) ⬆️

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 25 bytes 2.14MB 0.0%
antd.min.js 25 bytes 1.75MB 0.0%

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.

Unexpected cursor in Select

2 participants