fix(site/src): keep short mobile dropdowns above the software keyboard (#26965)

This commit is contained in:
Danielle Maywood
2026-07-02 13:37:13 +00:00
committed by GitHub
parent 8bcc24f032
commit 332e32d42b
2 changed files with 15 additions and 5 deletions
+2 -1
View File
@@ -36,7 +36,8 @@
dropdowns.
- `--mobile-dropdown-above-composer-bottom`: distance from
the layout viewport bottom to a point just above the
composer's top edge.
composer's top edge, clamped to stay above the software
keyboard when the keyboard covers the composer.
- `--mobile-dropdown-above-composer-max-height`: maximum
height the `-above-composer` variant can grow to without
extending past the visible viewport top.
@@ -645,15 +645,24 @@ export const AgentChatInput: FC<AgentChatInputProps> = ({
const fixedViewportBottom = fixedProbe.getBoundingClientRect().bottom;
const visibleViewportTop = viewport?.offsetTop ?? 0;
const bottom = Math.max(0, fixedViewportBottom - rect.bottom);
// Distance from the fixed-position viewport bottom to a point
// just above the composer's top edge.
// Keep the dropdown's bottom edge above the software keyboard,
// which covers the bottom of the layout viewport without moving
// fixed-positioned elements.
const keyboardInset = viewport
? Math.max(
0,
fixedViewportBottom - (viewport.offsetTop + viewport.height),
)
: 0;
const aboveComposerBottom = Math.max(
0,
fixedViewportBottom - rect.top + composerGap,
keyboardInset + composerGap,
);
const dropdownBottomEdgeTop = fixedViewportBottom - aboveComposerBottom;
const maxHeightCandidates = [
rect.top - visibleViewportTop - composerGap - viewportPadding,
rect.top - composerGap - viewportPadding,
dropdownBottomEdgeTop - visibleViewportTop - viewportPadding,
dropdownBottomEdgeTop - viewportPadding,
].filter((height) => height > 0);
const aboveComposerMaxHeight = Math.max(
minimumMenuHeight,