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.
This commit is contained in:
G30 2026-10-10 02:28:52 -04:00 • committed by GitHub
parent d3acc2706d
commit c65ce18a9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {