mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: clamp teleported dropdown position to viewport bounds
When neither upward nor downward direction has enough space for the full menu height, clamp the position so the menu stays within the viewport instead of overflowing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -178,11 +178,10 @@ function toggleDropdown() {
|
||||
spaceBelow < MENU_HEIGHT_WITH_GAP && spaceAbove > spaceBelow
|
||||
|
||||
if (shouldTeleport) {
|
||||
if (openUpward.value && rect.top < MENU_HEIGHT_WITH_GAP) {
|
||||
openUpward.value = false
|
||||
}
|
||||
fixedPosition.value = {
|
||||
top: openUpward.value ? rect.top : rect.bottom,
|
||||
top: openUpward.value
|
||||
? Math.max(MENU_HEIGHT_WITH_GAP, rect.top)
|
||||
: Math.min(rect.bottom, window.innerHeight - MENU_HEIGHT_WITH_GAP),
|
||||
left: Math.min(rect.right, window.innerWidth - MENU_WIDTH)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user