fix: constrain modals to viewport height with internal scrolling
Build & Push Docker Image / build (push) Successful in 4m2s
Build & Push Docker Image / build (push) Successful in 4m2s
Modal dialogs (e.g. the create-event form) grew beyond the screen and scrolled the page behind them. Cap the card at the viewport height and scroll the body inside it, keeping the header pinned. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,10 +42,10 @@ export default function Modal({ title, children, onClose, maxWidth = 'max-w-lg'
|
|||||||
aria-modal="true"
|
aria-modal="true"
|
||||||
aria-labelledby={titleId}
|
aria-labelledby={titleId}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
className={`relative bg-th-card rounded-2xl border border-th-border shadow-2xl w-full ${maxWidth} focus:outline-hidden`}
|
className={`relative bg-th-card rounded-2xl border border-th-border shadow-2xl w-full ${maxWidth} max-h-[calc(100vh-2rem)] flex flex-col focus:outline-hidden`}
|
||||||
>
|
>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex items-center justify-between px-6 py-4 border-b border-th-border rounded-t-2xl">
|
<div className="flex items-center justify-between px-6 py-4 border-b border-th-border rounded-t-2xl shrink-0">
|
||||||
<h2 id={titleId} className="text-lg font-semibold text-th-text">{title}</h2>
|
<h2 id={titleId} className="text-lg font-semibold text-th-text">{title}</h2>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -56,8 +56,8 @@ export default function Modal({ title, children, onClose, maxWidth = 'max-w-lg'
|
|||||||
<X size={20} />
|
<X size={20} />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/* Body */}
|
{/* Body — scrolls inside the card instead of overflowing the viewport */}
|
||||||
<div className="p-6">
|
<div className="p-6 overflow-y-auto min-h-0">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user