Repository navigation
fix(modal): prevent scroll chaining to the page on iOS Safari - #636
Merged
nonsobethel0-dev merged 2 commits intoSep 23, 2026
Conversation
useModalOverflow now toggles a modal-scroll-locked class on <html> alongside body overflow:hidden; globals.css sets overscroll-behavior: none on html/body under it so iOS Safari can't chain scroll or rubber-band the page behind an open modal.
Cap the dialog to the viewport (100dvh - 2rem) with overflow-y-auto and overscroll-contain, and contain overscroll on the backdrop, so tall modals scroll internally and hitting the top/bottom never chains to the page on iOS Safari. Add a Modal test for the containment classes.
|
@presidoclintonbased-alt Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
❌ Deploy Preview for boisterous-sunshine-dd4c4c failed.
|
nonsobethel0-dev
merged commit Sep 23, 2026
e02bba1
into
Parashield-Protocol:main
0 of 4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Modallocks page scroll throughuseModalOverflow, which only setsbody { overflow: hidden }. On iOS Safari that isn't enough:overflow-y, so a tall modal on a phone (e.g. Buy Policy, Deposit) grew past the viewport and every touch-scroll went straight to the page.Changes
Commit 1: page-level lock (
useModalOverflow+globals.css)modal-scroll-lockedclass (exported asSCROLL_LOCK_CLASS) to<html>, and removes it once the last lock is released orresetModalOverflow()runs. It uses the sameactiveLocksset, so stacked modals still work.globals.css:html.modal-scroll-locked, html.modal-scroll-locked body { overscroll-behavior: none; }stops the page itself from rubber-banding or chaining.Commit 2: dialog-level containment (
Modal.tsx)max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain.dvhtracks iOS's collapsing toolbar, and2remmatches the backdrop'sp-4.overscroll-contain.touch-action: noneon the overlay. Browsers apply it to descendants as well, so it would also stop users scrolling inside the modal.Tests
useModalOverflow.test.ts: the class is present only while at least one lock is held (checked with two stacked locks), andresetModalOverflow()clears it.Modal.test.tsx: the dialog and backdrop have the containment and viewport-cap classes.Verification
npx vitest run src/__tests__/useModalOverflow.test.ts src/__tests__/Modal.test.tsx: all new tests pass (6/6 hook, and the new Modal test).main, not caused by this PR:Modal.test.tsx › focuses a focusable element on openalready fails, andtscalready reports a type error inBuyPolicyModal.test.tsx. No new type errors.Closes [bug] Modal does not prevent scroll chaining on iOS Safari #552
Closes [security] Wallet address displayed in page title via metadata #553
Closes [ux] EmptyState component does not support custom action button styling #554
Closes [bug] Claims export downloads CSV with wrong filename timestamp #555