fix: compute Move To flyout max-height dynamically from viewport space
This commit is contained in:
@@ -149,6 +149,10 @@ function MoveToSubmenu({ channels, onMove, btnClass, btnStyle }: MoveToSubmenuPr
|
|||||||
|
|
||||||
flyout.style.left = `${left}px`;
|
flyout.style.left = `${left}px`;
|
||||||
flyout.style.top = `${top}px`;
|
flyout.style.top = `${top}px`;
|
||||||
|
|
||||||
|
const availableHeight = window.innerHeight - top - 8;
|
||||||
|
const maxHeight = Math.max(availableHeight, 120);
|
||||||
|
flyout.style.maxHeight = `${maxHeight}px`;
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -170,7 +174,7 @@ function MoveToSubmenu({ channels, onMove, btnClass, btnStyle }: MoveToSubmenuPr
|
|||||||
{open && ReactDOM.createPortal(
|
{open && ReactDOM.createPortal(
|
||||||
<div
|
<div
|
||||||
ref={flyoutRef}
|
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 }}
|
style={{ left: -9999, top: -9999 }}
|
||||||
onMouseEnter={cancelCloseTimer}
|
onMouseEnter={cancelCloseTimer}
|
||||||
onMouseLeave={startCloseTimer}
|
onMouseLeave={startCloseTimer}
|
||||||
|
|||||||
Reference in New Issue
Block a user