Skip to content

Commit

Permalink
Update modal.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey authored May 21, 2023
1 parent 47f73b1 commit da52f0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/shared/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ export default function Modal({
focusTrapOptions={{
initialFocus: false,
onActivate: () => {
// prevent scroll outside of modal
// prevent scroll outside of modal when modal is open
document.body.style.overflow = "hidden";
},
onDeactivate: () => {
// allow scroll outside of modal when modal is closed
document.body.style.overflow = "auto";
},
}}
>
<div className="absolute">
Expand Down

0 comments on commit da52f0c

Please sign in to comment.