Skip to content

fix: keep @ file picker within the visible area above the composer - #768

Open
killersteps wants to merge 1 commit into
agegr:mainfrom
killersteps:fix/at-file-menu-visible-height
Open

fix: keep @ file picker within the visible area above the composer#768
killersteps wants to merge 1 commit into
agegr:mainfrom
killersteps:fix/at-file-menu-visible-height

Conversation

@killersteps

@killersteps killersteps commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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 fixed min(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 used overflow: hidden with 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:

  1. Observe the menu's bottom edge against the nearest clipping ancestor (the chat panel under the tab bar).
  2. Set maxHeight to that remaining space, still bounded by min(48vh, 400px).
  3. Make the match list a flex child (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.
  • Source assertion: the @ menu applies atMenuMaxHeight and no longer uses a bare min(48vh, 400px) max-height.
  • Existing slash-menu height helper is unchanged.

node --experimental-strip-types --test components/ChatInput.test.mjs passes.


问题

斜杠命令菜单已经会测量输入框上方的剩余空间,把高度裁在顶栏以下。

@ 文件列表还在用固定的 min(48vh, 400px)。新会话或消息很少时,输入框偏上,一长串匹配会往上撑出这块空间。排在前面的文件其实还在 DOM 里,但被顶栏挡住:看不见,也点不到。外层是 overflow: hidden,内层高度又和这个固定上限绑在一起,所以滚轮也滚不出被挡住的那几项。

解决方案

复用斜杠菜单已经在用的「向上可用高度」:

  1. 用菜单底边对最近的裁剪祖先(顶栏下面的聊天区)做测量。
  2. maxHeight 收成这块剩余空间,同时仍不超过 min(48vh, 400px)
  3. 匹配列表改成 flex 子项(minHeight: 0; overflowY: auto),高度变矮时在内部滚动,而不是把顶部裁掉。

测试

  • getUpwardMenuMaxHeight(200, 36) 得到 156px,小于原来的 400px 上限,对应「列表顶出顶栏」的情况。
  • 源码断言:@ 菜单使用 atMenuMaxHeight,不再写死单独的 min(48vh, 400px)
  • 斜杠菜单原有高度逻辑不变。

node --experimental-strip-types --test components/ChatInput.test.mjs 通过。

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.
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.

1 participant