Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inset of iOS devices is scrollable on modals #250

Open
AlexCheongIE opened this issue Mar 19, 2022 · 1 comment
Open

Inset of iOS devices is scrollable on modals #250

AlexCheongIE opened this issue Mar 19, 2022 · 1 comment

Comments

@AlexCheongIE
Copy link

I have noticed that the inset on iOS devices are scrollable when a modal is open. I have read most of the issues related to iOS here and it has no mention on this inset.

The fix for this is usually to add in viewport-fit=cover to the viewport meta tag and then the relevant paddings based on the CSS envrionment variable safe-area-inset-*

<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">

There is certainly more value in updating the design of a website to cater for this safe area, but I'm wondering if there is a way to lock the scroll even without the meta tag addition or since it's occurring based on the vendor, it should be the responsibility of the consumer to use the tool available (meta tag) to support it?

Safe area example - scrolling anywhere on the red shaded sides will not be locked
source: https://webkit.org/blog/7929/designing-websites-for-iphone-x/

Steps To Reproduce:

  1. Go to https://bodyscrolllock-modal.vercel.app/ on any iOS device with an inset and safe area
  2. Open the modal to lock the scroll
  3. Use a scroll or swipe gesture on the inset area on either side of the screen
  4. Notice that it's scrolling the back page

The current behavior

Scrolling of the background is still possible.

The expected behavior

Scrolling should be locked.

Here is a video to demonstrate the scroll behaviour
Example

@taejs
Copy link

taejs commented May 27, 2022

Is there any quick fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants