Comments (5)
The issue with the background scrolling on iOS is a bug in the way the browser handles overflow: hidden
on the body element. Applying it to the <html />
tag too will rectify this issue.
from modaal.
Thanks Alex, we'll investigate it and work in a fix soon.
from modaal.
I've spent some time this afternoon testing a variety of possible solutions to this one which only seem to trigger other undesirable side effects. See below for a list of solutions:
- Added overflow hidden to the html element as well as per @alexmccabe's suggestion. No change to background scrolling.
- Moving all styles for body overflow control into a class rather than directly inline, as well as applying that same class to the html element. No change to background scrolling.
- Based on a few stack overflow tickets there were some suggestions to add position relative to the body element with overflow hidden. Tried this with no change to background scrolling.
- Setting position fixed to body or html (never both at the same time) got us the closest to resolving this, and in fact did resolve this by stopping both the background scrolling and pushing over the overlay. The side effect however was that, no matter how far down the page you were scrolled before opening a modal, when you did open a modal the main body jumped all the way back to the top of the page in the background, meaning when you close the modal you're left at the start of the page again. This bug in my opinion isn't an acceptable side effect, as it may only create more frustration for the user by forcing them to have to find there way back to where they were before opening the modal.
If we had to make a decision between the existing and above implementations, I would be inclined to lean toward leaving the background scrolling as is, despite the overflow hidden's, as it retains their overall position in the page on close versus forcing the user to scroll back to the content where they opened the modal from.
But with that said, we are getting close to a solution that we may be able to work in to get the ideal outcome, so it's worth keeping this ticket open for the time being.
from modaal.
Hi, I don't know if you found a solution (I guess not), but as far as for us it is not so 'bad' –it is, but not critical– to go up to the beginning of the page, just adding a fixed position, hidden overflow and with 100% to the html when opening, and removing or setting back to its default (targetting iOS devices) make us the deal.
from modaal.
If this is still an issue, I came up with a solution that actually works across all devices. It's not perfect (emulating mobile devices in Chrome, then using the mousewheel to scroll causes some jittering), but other than that it works pretty well.
https://github.com/alexmccabe/framework/blob/master/src/js/core/Scroll.js
from modaal.
Related Issues (20)
- Change of source image within content-source conflict HOT 2
- Focus management (focus trap) HOT 1
- Option to loop through the gallery
- How To: Inserting modal content further up the page HOT 3
- Back tab focus not working
- Opening a image gallery from multiple sources
- How to open modal not user button? HOT 5
- How to close the modal?? HOT 1
- Question: is it possible to somehow autoplay the gallery images, so that no user interactive is needed?
- Close button first focusable element.
- Multiple instances of modaal issue HOT 3
- Getting clicked element's attributes HOT 9
- Modaal window background color
- should_open option doesn't work as data attribute
- Support ES6 loading
- Modal content outside ARIA landmark HOT 2
- How can I make this work with keyboard shortcuts.
- Animation options
- How to close in iframe/ajax?
- MP4 video not start in Mac Safari
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modaal.