Skip to content

Conversation

@Chiaki-xps
Copy link
Contributor

@Chiaki-xps Chiaki-xps commented Dec 15, 2025

根据本次修改内容,帮你填写 PR 模板:


🤔 这个变动的性质是?

  • 🆕 新特性提交
  • 🐞 Bug 修复
  • 📝 站点、文档改进
  • 📽️ 演示代码改进
  • 💄 组件样式/交互改进
  • 🤖 TypeScript 定义更新
  • 📦 包体积优化
  • ⚡️ 性能优化
  • ⭐️ 功能增强
  • 🌐 国际化改进
  • 🛠 重构
  • 🎨 代码风格优化
  • ✅ 测试用例
  • 🔀 分支合并
  • ⏩ 工作流程
  • ⌨️ 无障碍改进
  • ❓ 其他改动(是关于什么的改动?)

🔗 相关 Issue

当浏览器不支持 SpeechRecognition API 时,Sender 组件的语音按钮显示异常,按钮不可见但 hover 时会出现禁用提示。

💡 需求背景和解决方案

问题描述:
当浏览器不支持 SpeechRecognition API(如部分移动端浏览器或旧版浏览器)时,Sender 组件的语音按钮虽然设置了 disabled 状态,但没有对应的禁用样式,导致按钮不可见,用户体验不佳。

解决方案:

  1. SpeechButton 组件中,当 onSpeechDisabledtrue 时,添加 speech-disabled 类名
  2. 在样式文件中添加 &-speech-disabled 禁用样式,包括灰色文字和 not-allowed 光标

修改前后对比:

  • 修改前:语音按钮不可见,hover 时显示禁用提示
  • 修改后:语音按钮显示为灰色静音图标,hover 时显示禁止光标

📝 更新日志

语言 更新描述
🇺🇸 英文 Sender: Add disabled style for SpeechButton when browser doesn't support SpeechRecognition.
🇨🇳 中文 Sender: 当浏览器不支持语音识别时,为语音按钮添加禁用样式。

Summary by CodeRabbit

发布说明

  • 样式

    • 优化了语音按钮的禁用态视觉表现:禁用或标记为“语音禁用”时文字颜色、光标及悬停样式更明确,提升交互一致性。
  • 重构

    • 调整了语音按钮的类名与属性处理,属性展开方式与类名组合改进,确保禁用逻辑与样式保持一致。

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

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.

📝 Walkthrough

Walkthrough

对语音按钮组件的 props 传递与 className 组合进行了调整,新增 speech-disabled 的样式规则并将其映射到按钮的禁用逻辑和视觉状态。

Changes

Cohort / File(s) Change summary
语音按钮组件改进
packages/x/components/sender/components/SpeechButton/index.tsx
引入 classNames 并用于组合 className;从 props 中解构出 className 并使用 restProps 展开到 ActionButton;新增条件类 speech-disableddisabled 计算为 `onSpeechDisabled
发送器样式扩展
packages/x/components/sender/style/index.ts
${componentCls}-actions-btn 范围内新增 speech-disabled/禁用样式:文本颜色设为 colorTextDisabled、光标为 not-allowed,并确保悬停时保持禁用文本颜色。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 分钟

  • 检查 disabled 的计算与 onSpeechDisabled 在所有使用场景下的交互是否一致。
  • 验证 className 合并是否会覆盖传入样式或引发冲突。
  • 确认新增样式选择器的作用域与优先级不会影响其他按钮变体。

Poem

🐰 按钮换了新装,边缘更明朗,
classNames 搭配轻轻唱,
禁用一声 cursor 不许忙,
文本变淡却心不慌,
语音小梦继续向阳。

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题描述了主要改动——为不支持SpeechRecognition API的浏览器中的SpeechButton添加禁用样式。标题清晰具体,准确反映了变更的核心目的。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 123191d and 29163ba.

📒 Files selected for processing (2)
  • packages/x/components/sender/components/SpeechButton/index.tsx (2 hunks)
  • packages/x/components/sender/style/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/x/components/sender/style/index.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/x/components/sender/components/SpeechButton/index.tsx (1)
packages/x/components/sender/components/ActionButton.tsx (1)
  • ActionButtonContext (20-20)
⏰ 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). (3)
  • GitHub Check: build preview
  • GitHub Check: test
  • GitHub Check: size
🔇 Additional comments (1)
packages/x/components/sender/components/SpeechButton/index.tsx (1)

3-3: speech-disabled 样式挂载方式合理,props 处理也保持兼容

  • 使用 classNames(className, { [\${prefixCls}-speech-disabled`]: onSpeechDisabled })的方式,把调用方传入的className` 与禁用态样式合并,行为清晰且不会覆盖外部样式。
  • const { className, ...restProps } = props; 然后在 JSX 中先写 icon/color/variant,再展开 ...restProps,最后显式传入 classNameaction="onSpeech",保证:
    • className 不会被调用方 props 覆盖,而是统一走合并逻辑;
    • action="onSpeech" 始终以组件自身为准,不会被误改;
    • 其余 ButtonProps(如 onClickstyle 等)仍完整透传到 ActionButton
  • 之前 review 提到的类名拼接问题,这里已经修正为 ${prefixCls}-speech-disabled,与样式文件中 .${componentCls}-actions-btn-speech-disabled 的预期一致。

整体改动简洁明确,没有发现新的问题。

Also applies to: 10-10, 26-29


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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

Preview failed

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Chiaki-xps, 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!

本次拉取请求旨在解决 Sender 组件中语音按钮的用户体验问题。此前,当浏览器不支持语音识别功能时,语音按钮虽然处于禁用状态,但没有明确的视觉反馈,导致用户无法察觉其状态。通过引入新的禁用样式,现在语音按钮将以灰色的静音图标和禁止光标显示,从而清晰地向用户传达其不可用状态,提升了界面的可用性和用户体验。

Highlights

  • 修复语音按钮显示问题: 当浏览器不支持 SpeechRecognition API 时,为 Sender 组件中的 SpeechButton 添加了禁用样式,解决了按钮不可见但悬停时出现禁用提示的问题。
  • 引入 classnames: 在 SpeechButton 组件中引入 classnames 库,以便根据条件动态添加 CSS 类。
  • 动态添加禁用类和状态: 当 onSpeechDisabledtrue 时,为 SpeechButton 添加 speech-disabled 类名,并更新 disabled 属性以反映禁用状态。
  • 新增禁用样式: 在样式文件中为 speech-disabled 类添加了灰色文本颜色和 not-allowed 光标样式,确保禁用状态下的视觉一致性。
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

这个 PR 旨在修复当浏览器不支持语音识别 API 时,语音按钮样式异常的问题。整体思路是正确的,通过添加一个特定的 CSS 类来应用禁用样式。我对代码实现有几点建议,主要集中在 SpeechButton 组件中类名的构建方式和 disabled 属性的冗余处理上。这些修改将使代码更简洁且符合组件的现有设计。样式文件的修改看起来没有问题。

className={classNames(className, {
[`${prefixCls}-actions-btn-speech-disabled`]: onSpeechDisabled,
})}
disabled={onSpeechDisabled || restProps.disabled}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

ActionButton 组件内部已经根据 action 属性和来自 context 的 onSpeechDisabled 值处理了禁用状态。因此,在这里显式传递 disabled={onSpeechDisabled || restProps.disabled} 是多余的,并且使代码逻辑更难理解。建议移除这一行,让 ActionButton 自行管理其禁用状态,这样代码会更简洁。

@codecov
Copy link

codecov bot commented Dec 15, 2025

Bundle Report

Changes will increase total bundle size by 320.38kB (10.52%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antdx-array-push 1.75MB -1.19MB (-40.4%) ⬇️
x-markdown-array-push 1.61MB 1.51MB (1413.46%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: antdx-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antdx.min.js (New) 1.75MB 1.75MB 100.0% 🚀
antdx.js (Deleted) -2.94MB 0 bytes -100.0% 🗑️
view changes for bundle: x-markdown-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
latex.js (New) 513.04kB 513.04kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.ttf (New) 63.63kB 63.63kB 100.0% 🚀
static/KaTeX_Main-Regular.*.ttf (New) 53.58kB 53.58kB 100.0% 🚀
static/KaTeX_Main-Bold.*.ttf (New) 51.34kB 51.34kB 100.0% 🚀
static/KaTeX_Main-Italic.*.ttf (New) 33.58kB 33.58kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.woff (New) 33.52kB 33.52kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.ttf (New) 32.97kB 32.97kB 100.0% 🚀
static/KaTeX_Math-Italic.*.ttf (New) 31.31kB 31.31kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.ttf (New) 31.2kB 31.2kB 100.0% 🚀
static/KaTeX_Main-Regular.*.woff (New) 30.77kB 30.77kB 100.0% 🚀
static/KaTeX_Main-Bold.*.woff (New) 29.91kB 29.91kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.woff2 (New) 28.08kB 28.08kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.ttf (New) 27.56kB 27.56kB 100.0% 🚀
static/KaTeX_Main-Regular.*.woff2 (New) 26.27kB 26.27kB 100.0% 🚀
static/KaTeX_Main-Bold.*.woff2 (New) 25.32kB 25.32kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.ttf (New) 24.5kB 24.5kB 100.0% 🚀
latex.css (New) 24.32kB 24.32kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.ttf (New) 22.36kB 22.36kB 100.0% 🚀
static/KaTeX_Main-Italic.*.woff (New) 19.68kB 19.68kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.ttf (New) 19.58kB 19.58kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.ttf (New) 19.57kB 19.57kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.ttf (New) 19.44kB 19.44kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.woff (New) 19.41kB 19.41kB 100.0% 🚀
static/KaTeX_Math-Italic.*.woff (New) 18.75kB 18.75kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.woff (New) 18.67kB 18.67kB 100.0% 🚀
static/KaTeX_Main-Italic.*.woff2 (New) 16.99kB 16.99kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.woff2 (New) 16.78kB 16.78kB 100.0% 🚀
static/KaTeX_Script-Regular.*.ttf (New) 16.65kB 16.65kB 100.0% 🚀
static/KaTeX_Math-Italic.*.woff2 (New) 16.44kB 16.44kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.woff2 (New) 16.4kB 16.4kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.woff (New) 16.03kB 16.03kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.woff (New) 14.41kB 14.41kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.woff (New) 14.11kB 14.11kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.woff2 (New) 13.57kB 13.57kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.woff (New) 13.3kB 13.3kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.woff (New) 13.21kB 13.21kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.ttf (New) 12.37kB 12.37kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.ttf (New) 12.34kB 12.34kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.woff (New) 12.32kB 12.32kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.ttf (New) 12.23kB 12.23kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.woff2 (New) 12.22kB 12.22kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.woff2 (New) 12.03kB 12.03kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.ttf (New) 11.51kB 11.51kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.woff2 (New) 11.35kB 11.35kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.woff2 (New) 11.32kB 11.32kB 100.0% 🚀
static/KaTeX_Script-Regular.*.woff (New) 10.59kB 10.59kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.ttf (New) 10.36kB 10.36kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.woff2 (New) 10.34kB 10.34kB 100.0% 🚀
static/KaTeX_Script-Regular.*.woff2 (New) 9.64kB 9.64kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.woff (New) 7.72kB 7.72kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.woff (New) 7.66kB 7.66kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.ttf (New) 7.59kB 7.59kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.woff2 (New) 6.91kB 6.91kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.woff2 (New) 6.91kB 6.91kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.woff (New) 6.5kB 6.5kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.woff (New) 6.19kB 6.19kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.woff (New) 5.98kB 5.98kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.woff2 (New) 5.47kB 5.47kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.woff2 (New) 5.21kB 5.21kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.woff2 (New) 4.93kB 4.93kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.woff (New) 4.42kB 4.42kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.woff2 (New) 3.62kB 3.62kB 100.0% 🚀
x-markdown.min.js (Deleted) -103.89kB 0 bytes -100.0% 🗑️
x-markdown.min.css (Deleted) -2.75kB 0 bytes -100.0% 🗑️

@meet-student
Copy link
Member

meet-student commented Dec 15, 2025

@utoo/pack/

ci 编译异常 cc @kimteayon

@kimteayon
Copy link
Collaborator

kimteayon commented Dec 17, 2025

disabled 的样式需要在考虑下 不是没有设置 而是被 antd 的按钮覆盖了样式导致的 目前的修改方案有些冗余和不统一

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants