Skip to content

fix: auto complete can not scroll in dialog - #287

Merged
looplj merged 2 commits into
looplj:unstablefrom
Silentely:fix/playground-model-display-and-apikey-scroll
Dec 14, 2025
Merged

looplj merged 2 commits into
looplj:unstablefrom
Silentely:fix/playground-model-display-and-apikey-scroll

Conversation

@Silentely

Copy link
Copy Markdown
Contributor
  • 新增 TruncatedText 组件,实现智能文本截断提示功能,仅当文本被截断时才显示悬浮提示
  • 为 AutoComplete 和 AutoCompleteSelect 组件添加 portalContainer 属性,解决在 Dialog 内无法滚动的问题
  • 修改 PopoverContent 组件以支持容器指定,允许在对话框等复杂布局中正确处理弹出层
  • 在 API 密钥配置对话框中集成 portalContainer,修复模型映射选择器的滚动问题
  • 优化了自动完成组件的列表样式,移除固定高度,使其更灵活适应不同内容

修复在apikey密钥配置文件模型映射模型下拉列表无法滚动的问题

image

修复测试场模型名称过长被截断问题,增加悬浮组件显示完整名称

image

- 新增 TruncatedText 组件,实现智能文本截断提示功能,仅当文本被截断时才显示悬浮提示
- 为 AutoComplete 和 AutoCompleteSelect 组件添加 portalContainer 属性,解决在 Dialog 内无法滚动的问题
- 修改 PopoverContent 组件以支持容器指定,允许在对话框等复杂布局中正确处理弹出层
- 在 API 密钥配置对话框中集成 portalContainer,修复模型映射选择器的滚动问题
- 优化了自动完成组件的列表样式,移除固定高度,使其更灵活适应不同内容
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

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

本次拉取请求主要旨在提升用户界面体验,特别是针对自动完成组件和弹出层在复杂布局中的表现。通过引入一个智能文本截断组件,并为弹出层机制添加了可配置的容器支持,解决了在对话框内使用自动完成选择器时出现的滚动和显示问题。这些改进确保了长文本能够优雅地显示,并且弹出层在任何父容器中都能正确地定位和交互。

Highlights

  • 新增 TruncatedText 组件: 引入了一个新的 TruncatedText 组件,它能智能地截断过长的文本,并仅在文本被截断时才显示完整的悬浮提示。
  • 为自动完成组件添加滚动容器支持: AutoComplete 和 AutoCompleteSelect 组件现在支持 portalContainer 属性,允许指定弹出层(Popover)的渲染容器,解决了在对话框(Dialog)内滚动时出现的问题。
  • 优化 PopoverContent 组件: PopoverContent 组件已修改,以接受 container 属性,从而更好地支持在复杂布局(如对话框)中正确渲染弹出层。
  • 修复 API 密钥配置对话框滚动问题: 在 API 密钥配置对话框中集成了 portalContainer 功能,修复了模型映射选择器在对话框内无法正确滚动的问题。
  • 优化自动完成列表样式: 移除了自动完成组件列表的固定高度和溢出隐藏样式,使其能够更灵活地适应不同内容。
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. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 introduces a new TruncatedText component designed to display a tooltip only when its content is visually truncated, and integrates it into the AutoComplete and AutoCompleteSelect components. Additionally, it attempts to resolve a Popover scrolling issue within dialogs by adding a portalContainer prop to PopoverContent and passing a reference to the DialogContent element. However, the reviewer noted two key problems: the TruncatedText component lacks responsiveness to dynamic content or container resizing, suggesting a more robust implementation using useEffect and ResizeObserver; and the portalContainer solution for dialogs is currently ineffective because the DialogContent component does not forward refs, and useRef updates do not trigger necessary re-renders, recommending a useState with a callback ref approach and a separate modification to the DialogContent component.

@Silentely Silentely changed the title feat: 为自动完成组件添加滚动容器支持和智能文本截断功能 【WIP】feat: 为自动完成组件添加滚动容器支持和智能文本截断功能 Dec 14, 2025
- 在 TruncatedText 组件中使用 ResizeObserver 替代 mouseEnter/mouseLeave 事件,实现更准确的动态截断检测
- 重构 TruncatedText 组件使用 useEffect 管理生命周期,提升性能并确保容器大小变化时能正确响应
- 将 DialogContent 组件重构为使用 forwardRef 模式,提高代码可维护性和类型安全性
- 在 ApiKeysProfilesDialog 中适配对话框内容引用状态更新,确保 Popover 滚动功能正常工作
- 移除过时的 ref 类型,使用更合适的 HTMLDivElement 类型替代 DialogContentRef
@Silentely Silentely changed the title 【WIP】feat: 为自动完成组件添加滚动容器支持和智能文本截断功能 feat: 为自动完成组件添加滚动容器支持和智能文本截断功能 Dec 14, 2025
@looplj looplj changed the title feat: 为自动完成组件添加滚动容器支持和智能文本截断功能 fix: auto complete can not scroll in dialog Dec 14, 2025
@looplj
looplj merged commit 3473962 into looplj:unstable Dec 14, 2025
2 checks passed
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.

2 participants