fix: suppress Sender borderless focus outline#1963
Conversation
📝 WalkthroughWalkthrough本次变更在 Sender 组件的样式文件中新增了针对 borderless 输入框的聚焦样式控制,当元素或其内部 input/textarea 处于 focus-visible 状态时,移除默认的 outline 轮廓显示。 ChangesBorderless 输入焦点样式
Estimated code review effort: 1 (Trivial) | ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the styling for the sender component and its slot-textarea to remove the default outline on focus-visible states when using borderless inputs. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/x/components/sender/style/slot-textarea.ts (1)
9-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win与
index.ts中新增逻辑重复,建议抽取公共 mixin。
index.ts的genSenderStyle中新增了几乎完全相同的 borderless focus-visible outline 规则(&${antCls}-input-borderless+&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)→outline: none)。两处逻辑重复,建议抽取为一个共享的样式生成函数(例如genBorderlessFocusStyle(token)),分别在genSenderStyle与genSlotTextAreaStyle中复用,避免后续修改时遗漏其中一处。♻️ 抽取共享 mixin 示例
+// 可放置于共享的 util 文件,如 style/util.ts +const genBorderlessFocusStyle = (antCls: string) => ({ + [`&${antCls}-input-borderless`]: { + '&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)': { + outline: 'none', + }, + }, +});之后在两处分别引用
...genBorderlessFocusStyle(antCls)展开即可。Also applies to: 51-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/x/components/sender/style/slot-textarea.ts` at line 9, The borderless focus-visible outline style is duplicated between genSlotTextAreaStyle and genSenderStyle, so extract the shared rules into a reusable helper such as genBorderlessFocusStyle(token/antCls) and reuse it from both places. Keep the existing selectors for the borderless input class and focus-visible states in that shared helper, then spread the result back into the slot textarea and sender style generators so there is only one source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/x/components/sender/style/slot-textarea.ts`:
- Line 9: The borderless focus-visible outline style is duplicated between
genSlotTextAreaStyle and genSenderStyle, so extract the shared rules into a
reusable helper such as genBorderlessFocusStyle(token/antCls) and reuse it from
both places. Keep the existing selectors for the borderless input class and
focus-visible states in that shared helper, then spread the result back into the
slot textarea and sender style generators so there is only one source of truth.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ecfe8756-6a8c-4048-9c8e-d3e4dc92d938
📒 Files selected for processing (2)
packages/x/components/sender/style/index.tspackages/x/components/sender/style/slot-textarea.ts
背景
ant-design/ant-design#58250 在 antd 侧为 borderless 输入类组件补充了 focus-visible outline,用于改善普通无边框输入控件的键盘焦点可见性。
Ant Design X 的 Sender 内部会使用 antd 的
Input.TextArea和词槽Input,并统一设置为variant="borderless",但 Sender 本身已经有独立的容器、阴影和输入区域视觉。升级到包含该 antd 改动的版本后,Sender 内部输入在聚焦时会出现一条蓝色内部描边,和 Sender 设计不一致。修改
.ant-sender-input.ant-input-borderless范围内去掉 antd 新增的 focus outline。.ant-sender-slot-input.ant-input-borderless范围内同步去掉该 focus outline。影响
该改动恢复 Sender 现有视觉表现,避免 antd borderless focus outline 穿透到 Sender 内部输入区域。普通 antd Input/Select 等 borderless 场景仍保留 antd 侧的无障碍焦点样式。
验证
npm run lint:style --workspace packages/xnpm test --workspace packages/x -- sender/__tests__/index.test.tsx sender/__tests__/slot.test.tsx --runInBandantd lint packages/x/components/sender/style/index.ts --format jsonantd lint packages/x/components/sender/style/slot-textarea.ts --format jsonoutlineStyle均为noneSummary by CodeRabbit
outline,视觉更统一。