Skip to content

Conversation

@engvuchen
Copy link
Contributor

closed #6028

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#6028

💡 需求背景和解决方案

改动说明:

  1. tooltip 中的 popup,始终显示;

    1. 解决问题:content 的内容,当键入第一个字符、删除最后一个字符,触发 textarea 销毁,导致计算高度找不到 textarea 了,报错
  2. 取消 textarea onBlur 的计算高度

    1. 解决问题:在被 tooltip 包裹的 textarea 键入字符,不移出,5s 后隐藏 tooltip,触发 textarea onblur,也会计算高度,上面一样的问题
  3. popup 新增 isEmptyContent

    1. content 为空字符串,tooltip 原表现不显示浮层,由 tooltip 代码切换实现;
    2. 目前是增强了 hidePopup 判断,需要业务主动加上 hideEmptyPopup
  4. 去掉了一个 inner 的重复监听

📝 更新日志

  • 本条 PR 不需要纳入 Changelog

tdesign-vue-next

@tdesign-vue-next/chat

@tdesign-vue-next/auto-import-resolver

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@tdesign-bot
Copy link
Collaborator

TDesign Component Site Preview Open

Component Preview
tdesign-vue-next 完成
@tdesign-vue-next/chat 完成

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 1, 2025

tdesign-vue-next-demo

npm i https://pkg.pr.new/Tencent/tdesign-vue-next/@tdesign-vue-next/auto-import-resolver@6040
npm i https://pkg.pr.new/Tencent/tdesign-vue-next@6040
npm i https://pkg.pr.new/Tencent/tdesign-vue-next/@tdesign-vue-next/chat@6040

commit: c1be90c

@Wesley-0808 Wesley-0808 requested a review from Copilot October 14, 2025 07:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the tooltip component where popup positioning fails when content changes during textarea height calculations. The fix ensures tooltips remain visible consistently and prevents errors when the textarea element is destroyed during content updates.

  • Always display tooltip popup to prevent element destruction issues
  • Remove textarea height calculation on blur events to avoid timing conflicts
  • Enhanced empty content detection for better popup visibility control

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/components/tooltip/tooltip.tsx Removes early return for empty content to always render popup
packages/components/textarea/textarea.tsx Removes height calculation on blur and consolidates value watchers
packages/components/popup/popup.tsx Adds improved empty content detection function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}>;

/** 判断是否为空字符串,或是空插槽 */
function isEmptyContent(node: any) {
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The parameter type 'any' is too broad and reduces type safety. Consider using a more specific type like 'VNode | string | null | undefined' or creating a union type for the expected node types.

Copilot uses AI. Check for mistakes.
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.

[tooltip + textarea] 按第一个按钮时抛出未处理异常

2 participants