mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: prefer direction with more available space for dropdown
Compare space above vs below the trigger and open toward whichever side has more room. Prevents flipping upward when the menu would overflow even more in that direction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,7 +146,9 @@ function toggleDropdown() {
|
||||
if (disabled) return
|
||||
if (!isOpen.value && triggerRef.value) {
|
||||
const rect = triggerRef.value.getBoundingClientRect()
|
||||
openUpward.value = rect.bottom + MENU_HEIGHT > window.innerHeight
|
||||
const spaceBelow = window.innerHeight - rect.bottom
|
||||
const spaceAbove = rect.top
|
||||
openUpward.value = spaceBelow < MENU_HEIGHT && spaceAbove > spaceBelow
|
||||
}
|
||||
isOpen.value = !isOpen.value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user