Files
Naiyuan Qing b9faa27a67 fix(editor): open mention/slash popup upward and clamp height to viewport (#5376)
The `@`-mention and `/`-command suggestion popups defaulted to
`placement: "bottom-start"`, so they stayed below the caret whenever any
space existed below it — even when far more room was above. In
bottom-anchored composers (chat input, issue comment/reply) that meant the
list opened down over the send controls and, near the viewport bottom, was
squashed or clipped off-screen.

Two compounding causes:

- The preferred side was the cramped one. Composers' roomy side is above
  the caret, so default to `top-start`; `flip` still sends it down when the
  caret is near the viewport top.
- The floating-ui `size` middleware wrote `maxHeight` on the outer wrapper,
  which does not clip — the inner list is the scroll container and carried
  its own fixed `max-h-[300px]/[420px]`. That viewport-unaware cap was the
  real height authority and could overflow. Publish the size middleware's
  `availableHeight` as a CSS var and have the list clamp to
  `min(designMax, availableHeight)`, so there is a single, viewport-aware
  height authority. Drop the old `Math.max(120, ...)` floor that forced
  overflow in tight bands.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 11:04:52 +08:00
..