diff --git a/web/src/components/RelativeModal.jsx b/web/src/components/RelativeModal.jsx index f566b5417..5186cc8a6 100644 --- a/web/src/components/RelativeModal.jsx +++ b/web/src/components/RelativeModal.jsx @@ -69,14 +69,15 @@ export default function RelativeModal({ let newTop = top; let newLeft = left; - // too far right - if (newLeft + width + WINDOW_PADDING >= windowWidth - WINDOW_PADDING) { - newLeft = windowWidth - width - WINDOW_PADDING; - } // too far left - else if (left < WINDOW_PADDING) { + if (left < WINDOW_PADDING) { newLeft = WINDOW_PADDING; } + // too far right + else if (newLeft + width + WINDOW_PADDING >= windowWidth - WINDOW_PADDING) { + newLeft = windowWidth - width - WINDOW_PADDING; + } + // too close to bottom if (top + menuHeight > windowHeight - WINDOW_PADDING + window.scrollY) { newTop = WINDOW_PADDING;