reposition the modal when close to bottom

This commit is contained in:
Bernt Christian Egeland 2023-02-15 20:48:04 +01:00
parent 1715e2e09d
commit 776e73c9ea

View File

@ -80,7 +80,9 @@ export default function RelativeModal({
// too close to bottom
if (top + menuHeight > windowHeight - WINDOW_PADDING + window.scrollY) {
newTop = WINDOW_PADDING;
// If the pop-up modal would extend beyond the bottom of the visible window,
// reposition the modal to appear above the clicked icon instead
newTop = top - menuHeight;
}
if (top <= WINDOW_PADDING + window.scrollY) {