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

Modal background scrollable (iOS Safari) #22311

Closed
SebastianSchenk opened this issue Mar 30, 2017 · 33 comments
Closed

Modal background scrollable (iOS Safari) #22311

SebastianSchenk opened this issue Mar 30, 2017 · 33 comments

Comments

@SebastianSchenk
Copy link

System
iOS 10.2 (iPad Mini 3)

Browser
iOS Safari

Test case
https://v4-alpha.getbootstrap.com/components/modal/#live-demo

Description
When opening a modal in any other browser than iOS Safari, the background isn't scrollable; neither by mouse wheel nor by touch.

On iOS Safari the background is scrollable, which shouldn't be the case as far as i know.

@oktalk
Copy link

oktalk commented Mar 30, 2017

To my knowledge there's no good solution for this issue. You'll end up making messy compromises. Even modals in Bootstrap v3 allow the background to scroll when a modal is open.

@bkdotcom
Copy link
Contributor

bkdotcom commented Apr 2, 2017

Webkit Bug 153852

@SebastianSchenk
Copy link
Author

Ok I see. Thank you.

@Johann-S
Copy link
Member

Johann-S commented Apr 3, 2017

Sorry @SebastianSchenk but I reopen your issue because we have to note that's a bug browser in our documentation

@Johann-S Johann-S reopened this Apr 3, 2017
@cvrebert cvrebert added docs and removed css labels Apr 4, 2017
@a3rev
Copy link

a3rev commented May 25, 2017

Hi - have used the bootstrap modal to create a form pop up in our plugin Contact Us page Contact People and the Premium Version. Love the script - but we are seeing bug in iOS - which is the bug raised in this issue.

The Modal pop opens a contact form from the profile card on the plugin -

The issue we are having is scroll in Mobile with iOS regardless if using Safari or Chrome browser

Have made a video to show the issue

When touch swipe if the finger lands on area between input fields on the form modal scrolls fine - but if the finger lands on an input field the modal don't scroll - the background does.

For a user this is very bad UX - for a user they do not know that is the issue - like we didn't until we figured it out.

We see this issue with Chrome on iOS as well as safari

@Duplicants
Copy link

Is there any workaround to this?

@Subair-tc
Copy link

we are facing the same issue for IOS 10.3 and for latest version iPhone of IOS it's working fine

@itwasmattgregg
Copy link

You can write a listener for touchMove and stopPropagation on that event which will only scroll the modal.

@radogado
Copy link

Please check this solution for fluid scroll of modal only, fixed background, iOS Safari: https://github.com/radogado/bootstrap-modal-ios

@sinneren
Copy link

@radogado doesn't work for me on iphone 5 iOs 10, 11

@radogado
Copy link

radogado commented Jul 10, 2018

@sinneren on iPhone 5 iOS 10 landscape, there is a bug with the top Safari toolbar. Is this the problem you experience? Thanks.
There is no iOS 11 for iPhone 5 and the script seems to work on iPhone 5s iOS 11.

@sinneren
Copy link

@radogado I use both iPhones with 10 and 11 iOS. And after including your css and js the background is still scrollable :( I tried many solutions, with fixed position, with android css property, and many others... and I have no padding right of modal... why we don't have only android in this world :D

@radogado
Copy link

@sinneren Please try the demo first, not your app, because I tested it and it works. Thanks! https://radogado.github.io/bootstrap-modal-ios/

@SebastianSchenk
Copy link
Author

@radogado don't know if this demo is intended to work on desktop, but on desktop the large modal is not scrollable at all

@radogado
Copy link

radogado commented Jul 12, 2018

@SebastianSchenk it is scrollable on desktop, except in Chrome 67 for Mac, which has a known bug, fixed in 68 beta. Which OS/browser are you testing? Thanks.

@sinneren
Copy link

sinneren commented Jul 12, 2018

@radogado Tried again include your script. In second try portrait works fine. But landscape has scrolling 50\50

@radogado
Copy link

@sinneren does the demo have the same problem? Trying to figure out if the problem is integration or the original script. What does 50/50 mean – sometimes the modal scrolls and sometimes not? Thanks.

@sinneren
Copy link

sinneren commented Jul 12, 2018

@radogado demo hasn't content at first. Then, nothing to affect for it on my integration. On demo I'm not seen it. 50\50 means is in half of cases I reproduce issue. Just for information. I like option just with portrait orientation.

@SebastianSchenk
Copy link
Author

@radogado yes, was using Chrome 67 for Mac

@kweij
Copy link

kweij commented Oct 2, 2018

I've soluted this problem using just JavaScript in the following gist:
https://gist.github.com/kweij/5a0eac4e68e80950c937b6eca10681cb

You can also use CSS for the styling, but I intentionally went for a solution in 1 place.

This may help others out here aswell.

@Sorazuu
Copy link

Sorazuu commented Oct 31, 2018

This work for me on ios 12 and iPhone 6s: vuetifyjs/vuetify#5207

Add: -webkit-overflow-scrolling: touch

@kuongknight
Copy link

Add to html:
overflow: scroll; -webkit-overflow-scrolling: touch;

@pretty
Copy link

pretty commented Nov 30, 2018

@kuongknight do you add this to the css of the modal or the parent body?

@kuongknight
Copy link

@pretty No

@Qvatra
Copy link

Qvatra commented Mar 22, 2019

any update on this?

@vkalach
Copy link

vkalach commented May 19, 2019

any update on this?

Add to html:
overflow: scroll; -webkit-overflow-scrolling: touch;

this solution works

@twbs twbs deleted a comment from AMIT1122 Jun 3, 2019
@xenogew
Copy link

xenogew commented Jun 28, 2019

any update on this?

Add to html:
overflow: scroll; -webkit-overflow-scrolling: touch;

this solution works

@vkalach
Do you mean add to <html> tag level?

Or just only add them to <body> tag level is also OK?

@sassquad
Copy link

sassquad commented Aug 6, 2019

I'll reference this comment I left on a similar issue - as it mentions a potential fix, that I came across on Stack Overflow.

@sgup
Copy link

sgup commented Sep 14, 2019

@xenogew
I added it to <html>, seems to fix the problem.

@patrickhlauke
Copy link
Member

if only Safari supported overscroll-behavior ... sigh

https://caniuse.com/#feat=mdn-css_properties_overscroll-behavior

@mdo
Copy link
Member

mdo commented Sep 18, 2020

Dug into this again—apparently this was fixed with iOS 13! See #20803 and the bug report https://bugs.webkit.org/show_bug.cgi?id=158342. Our iOS supported versions are 10+, so there's some risk in bringing back the -webkit-overflow-scrolling: touch; property.

Do folks think it's worth it?

@mdo
Copy link
Member

mdo commented Sep 6, 2021

Closing out as wildly stale. 😬

@mdo mdo closed this as completed Sep 6, 2021
@ohrrkan
Copy link

ohrrkan commented Jul 21, 2022

This issue was still present > not directly link to bootstrap but a more global IOS issue.

for people who need a solution until safari on IOS 16 better adoption (https://caniuse.com/mdn-css_properties_overscroll-behavior) :

JS :

document.body.addEventListener('show.bs.modal', () => { document.querySelector(':root').classList.add('PATCH_modal'); }); document.body.addEventListener('hidden.bs.modal', () => { document.querySelector(':root').classList.remove('PATCH_modal'); });

Css :

.PATCH_modal { touch-action: none; overscroll-behavior: none; overflow: hidden; -webkit-overflow-scrolling: auto; }

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

No branches or pull requests