From c65ce18a9aafa9b73c863f76e654d62219c7eee7 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Sat, 10 Oct 2026 02:28:52 -0400 Subject: [PATCH] fix: open select lists upward when there is no room below (#32153) Select always placed its list on the requested side, so a list opened near the bottom of the window (such as the model selector's filter list) ran off the screen. It now flips to the other side when the requested side is too short and the other side has more room, the same check the shared Dropdown already uses. --- src/lib/components/common/Select.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/components/common/Select.svelte b/src/lib/components/common/Select.svelte index 93a151d227..1e02ac4a88 100644 --- a/src/lib/components/common/Select.svelte +++ b/src/lib/components/common/Select.svelte @@ -66,7 +66,19 @@ contentEl.style.position = 'fixed'; contentEl.style.zIndex = '9999'; contentEl.style.minWidth = `${rect.width}px`; - if (side === 'top') { + + const contentHeight = contentEl.offsetHeight || 0; + const spaceBelow = window.innerHeight - rect.bottom - 4; + const spaceAbove = rect.top - 4; + + let openAbove = side === 'top'; + if (side === 'bottom' && spaceBelow < contentHeight && spaceAbove > spaceBelow) { + openAbove = true; + } else if (side === 'top' && spaceAbove < contentHeight && spaceBelow > spaceAbove) { + openAbove = false; + } + + if (openAbove) { contentEl.style.bottom = `${window.innerHeight - rect.top + 4}px`; contentEl.style.top = 'auto'; } else {