diff --git a/Components/admin/Owners/Modals/MessageModal.tsx b/Components/admin/Owners/Modals/MessageModal.tsx index 21e8407..8a64ca0 100644 --- a/Components/admin/Owners/Modals/MessageModal.tsx +++ b/Components/admin/Owners/Modals/MessageModal.tsx @@ -81,9 +81,15 @@ export default function MessageModal({ } const rect = anchorRef.current.getBoundingClientRect(); + const modalWidth = window.innerWidth < 768 ? window.innerWidth - 32 : 384; // sm: 384px (max-w-sm) + const maxRight = window.innerWidth - rect.right - 16; + + // Ensure modal doesn't overflow right edge + const right = Math.max(Math.min(maxRight, window.innerWidth - modalWidth - 16), 16); + setPosition({ top: rect.bottom + 12, - right: Math.max(window.innerWidth - rect.right - 16, 16), + right: right, }); } @@ -141,7 +147,7 @@ export default function MessageModal({ return createPortal(