reposition the modal when close to bottom (#5507)

This commit is contained in:
Bernt Christian Egeland 2023-02-16 12:47:18 -01:00 committed by GitHub
parent 1715e2e09d
commit c9cd810c9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,9 @@ export default function RelativeModal({
// too close to bottom // too close to bottom
if (top + menuHeight > windowHeight - WINDOW_PADDING + window.scrollY) { 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) { if (top <= WINDOW_PADDING + window.scrollY) {