diff --git a/web/public/index.html b/web/public/index.html index 99c4894dc..008438567 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -14,8 +14,8 @@
- - + + diff --git a/web/src/components/RelativeModal.jsx b/web/src/components/RelativeModal.jsx index 5b7a41d8a..c1ce43fe9 100644 --- a/web/src/components/RelativeModal.jsx +++ b/web/src/components/RelativeModal.jsx @@ -59,7 +59,13 @@ export default function RelativeModal({ className, role = 'dialog', children, on if (top + menuHeight > windowHeight - WINDOW_PADDING) { top = y - menuHeight; } - setPosition({ left, top: top + window.scrollY, width }); + + if (top <= WINDOW_PADDING) { + top = WINDOW_PADDING; + } + + const maxHeight = windowHeight - WINDOW_PADDING * 2 > menuHeight ? null : windowHeight - WINDOW_PADDING * 2; + setPosition({ left, top: top + window.scrollY, width, height: maxHeight }); const focusable = ref.current.querySelector('[tabindex]'); focusable && console.log('focusing'); focusable && focusable.focus(); @@ -76,16 +82,20 @@ export default function RelativeModal({ className, role = 'dialog', children, on const menu = (