Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add no scroll to focus trap

Steven Tey31eea39b0839
diff --git a/app/ui/modal.tsx b/app/ui/modal.tsx
index ffd48e58c0..3ec197f759 100644
--- a/app/ui/modal.tsx
+++ b/app/ui/modal.tsx
@@ -80,7 +80,15 @@ export default function Modal({
return (
<AnimatePresence>
{(setShowModal ? showModal : true) && (
- <FocusTrap focusTrapOptions={{ initialFocus: false }}>
+ <FocusTrap
+ focusTrapOptions={{
+ initialFocus: false,
+ onActivate: () => {
+ // prevent scroll outside of modal
+ document.body.style.overflow = "hidden";
+ },
+ }}
+ >
<div className="absolute">
<motion.div
ref={mobileModalRef}