fix: keep @ file picker within the visible area above the composer - #768
Open
killersteps wants to merge 1 commit into
Open
fix: keep @ file picker within the visible area above the composer#768killersteps wants to merge 1 commit into
killersteps wants to merge 1 commit into
Conversation
The slash menu already caps itself to the space above the composer. Reuse that measurement for @ file matches so a long list cannot paint through the session tab bar, and let the list scroll inside the cap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The slash command menu already measures remaining space above the composer and caps its height so it cannot paint through the session tab bar.
The
@file picker still used a fixedmin(48vh, 400px)cap. On a short-composer layout (new session, few messages) a long match list opened upward past that space. The leading files were still in the DOM, but they sat under the top bar — not visible and not clickable. The menu usedoverflow: hiddenwith a matching inner max-height, so scrolling could not bring those rows into view.Solution
Reuse the same measured upward cap the slash menu already uses:
maxHeightto that remaining space, still bounded bymin(48vh, 400px).minHeight: 0; overflowY: auto) so shrinking the menu scrolls instead of clipping the top.Tests
getUpwardMenuMaxHeight(200, 36)is 156px, which is below the old 400px cap — that is the overflow case.@menu appliesatMenuMaxHeightand no longer uses a baremin(48vh, 400px)max-height.node --experimental-strip-types --test components/ChatInput.test.mjspasses.问题
斜杠命令菜单已经会测量输入框上方的剩余空间,把高度裁在顶栏以下。
@文件列表还在用固定的min(48vh, 400px)。新会话或消息很少时,输入框偏上,一长串匹配会往上撑出这块空间。排在前面的文件其实还在 DOM 里,但被顶栏挡住:看不见,也点不到。外层是overflow: hidden,内层高度又和这个固定上限绑在一起,所以滚轮也滚不出被挡住的那几项。解决方案
复用斜杠菜单已经在用的「向上可用高度」:
maxHeight收成这块剩余空间,同时仍不超过min(48vh, 400px)。minHeight: 0; overflowY: auto),高度变矮时在内部滚动,而不是把顶部裁掉。测试
getUpwardMenuMaxHeight(200, 36)得到 156px,小于原来的 400px 上限,对应「列表顶出顶栏」的情况。@菜单使用atMenuMaxHeight,不再写死单独的min(48vh, 400px)。node --experimental-strip-types --test components/ChatInput.test.mjs通过。