Git Product home page Git Product logo

Comments (5)

alexmccabe avatar alexmccabe commented on May 27, 2024

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.

danhumaan avatar danhumaan commented on May 27, 2024

Thanks Alex, we'll investigate it and work in a fix soon.

from modaal.

danhumaan avatar danhumaan commented on May 27, 2024

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:

  1. Added overflow hidden to the html element as well as per @alexmccabe's suggestion. No change to background scrolling.
  2. 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.
  3. 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.
  4. 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.

victorbonilla avatar victorbonilla commented on May 27, 2024

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.

alexmccabe avatar alexmccabe commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.