Skip to content

Tweak modal overlay slide up on iOS#16143

Merged
georgerichmond merged 4 commits into
mainfrom
modal-overlay-tweak-slideup-on-ios
Jun 12, 2026
Merged

Tweak modal overlay slide up on iOS#16143
georgerichmond merged 4 commits into
mainfrom
modal-overlay-tweak-slideup-on-ios

Conversation

@georgerichmond

@georgerichmond georgerichmond commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Fixes a visual jump when the modal opens on iOS Safari, and addresses several other latent bugs found during investigation.
iOS open animation — adds { preventScroll: true } to the initial .focus() call, stopping iOS Safari from scrolling the viewport to chase the off-screen element before the slide-up transition runs
Backdrop tap-to-close on iOS — switches from mousedown to pointerdown, which fires reliably for touch input
prefersReducedMotion initialisation — state is now initialised lazily via useState(() => prefersReducedMotion()) rather than set synchronously inside an effect, removing a cascading-render lint violation
Close sentinel value — uses -1 instead of 0 as the "close in progress" marker, since 0 is a valid setTimeout return value
SSR guard placement — moved the typeof document === 'undefined' check to after all hooks to comply with the rules of hooks

Why?

The modal was visibly jumping on iOS when opening rather than sliding up smoothly.

Screenshots

Before After
before after

@georgerichmond georgerichmond requested a review from a team as a code owner June 12, 2026 09:02
@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@georgerichmond georgerichmond force-pushed the modal-overlay-tweak-slideup-on-ios branch from e495d7e to f7222b8 Compare June 12, 2026 09:12
@georgerichmond georgerichmond added the fix Departmental tracking: fix label Jun 12, 2026
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

@georgerichmond georgerichmond self-assigned this Jun 12, 2026
@georgerichmond georgerichmond force-pushed the modal-overlay-tweak-slideup-on-ios branch from e31ac91 to 4806639 Compare June 12, 2026 11:59
@georgerichmond georgerichmond added the run_chromatic Runs chromatic when label is applied label Jun 12, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Jun 12, 2026
Comment thread dotcom-rendering/src/components/ModalOverlay.tsx
Comment thread dotcom-rendering/src/components/ModalOverlay.tsx Outdated
@georgerichmond georgerichmond force-pushed the modal-overlay-tweak-slideup-on-ios branch from 4806639 to 5015f44 Compare June 12, 2026 13:04
@georgerichmond georgerichmond added the run_chromatic Runs chromatic when label is applied label Jun 12, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Jun 12, 2026
@georgerichmond georgerichmond merged commit 648a9d8 into main Jun 12, 2026
28 checks passed
@georgerichmond georgerichmond deleted the modal-overlay-tweak-slideup-on-ios branch June 12, 2026 13:46
@gu-prout

gu-prout Bot commented Jun 12, 2026

Copy link
Copy Markdown

Seen on PROD (merged by @georgerichmond 10 minutes and 13 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Departmental tracking: fix Seen-on-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants