fix: align teleported dropdown to trigger left edge instead of right

Amp-Thread-ID: https://ampcode.com/threads/T-019d6fd8-61fd-76ed-975a-71e146c1dd5e
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Jin Yi
2026-04-09 18:00:10 +09:00
parent 04a172c880
commit b77f0551bd

View File

@@ -178,11 +178,15 @@ function toggleDropdown() {
spaceBelow < MENU_HEIGHT_WITH_GAP && spaceAbove > spaceBelow
if (shouldTeleport) {
const left = Math.max(
0,
Math.min(rect.left, window.innerWidth - MENU_WIDTH)
)
fixedPosition.value = {
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)
left
}
}
}