fix: compute Move To flyout max-height dynamically from viewport space

This commit is contained in:
Jannis Braun
2026-03-10 00:35:40 +01:00
parent d0dca8b0a5
commit 8927d58288
@@ -149,6 +149,10 @@ function MoveToSubmenu({ channels, onMove, btnClass, btnStyle }: MoveToSubmenuPr
flyout.style.left = `${left}px`;
flyout.style.top = `${top}px`;
const availableHeight = window.innerHeight - top - 8;
const maxHeight = Math.max(availableHeight, 120);
flyout.style.maxHeight = `${maxHeight}px`;
}, [open]);
return (
@@ -170,7 +174,7 @@ function MoveToSubmenu({ channels, onMove, btnClass, btnStyle }: MoveToSubmenuPr
{open && ReactDOM.createPortal(
<div
ref={flyoutRef}
className="fixed z-[210] bg-surface-elevated rounded-md shadow-elevation-high py-1.5 min-w-[160px] max-h-[240px] overflow-y-auto scrollbar-thin animate-fade-in"
className="fixed z-[210] bg-surface-elevated rounded-md shadow-elevation-high py-1.5 min-w-[160px] overflow-y-auto scrollbar-thin animate-fade-in"
style={{ left: -9999, top: -9999 }}
onMouseEnter={cancelCloseTimer}
onMouseLeave={startCloseTimer}