Skip to content

Modal scrolling on mobile devices - what is the current state? #15852

Activity

cvrebert

cvrebert commented on Feb 20, 2015

@cvrebert
Collaborator

We explicitly mention this in the documentation:

Modals, navbars, and virtual keyboards

Overflow and scrolling

Support for overflow: hidden on the <body> element is quite limited in iOS and Android. To that end, when you scroll past the top or bottom of a modal in either of those devices' browsers, the <body> content will begin to scroll.


my solution (after doing some research):
body.modal-open { position: fixed; }

Note that this has the side-effect of "scrolling" to the top of the page while the modal is open.

mdo

mdo commented on Feb 22, 2015

@mdo
Member

Closing then.

felipe-canaviri

felipe-canaviri commented on Dec 22, 2015

@felipe-canaviri

Hello Bootstrap team,

As mentioned in the issue #7501, this bug should be fixed in the version 3.

I'm currently using version 3.3.6 and unfortunately the issue can be still be reproduced, similar to the animated picture above. Also, if you use an iPad with iOS 8 by browsing this page https://nakupanda.github.io/bootstrap3-dialog/, you'll be able to reproduce when opening the modal samples showed in the page. Please note that the samples in the page are using Bootstraop 3.3.5.

Despite that this effect is mentioned in the documentation, I wonder if there will be chances to fix the issue since it's really annoying when the modal has its own scrolling behavior.

Thanks so much in advance for any feedback you can provide.

dvf

dvf commented on Mar 6, 2016

@dvf

Why was this closed?

cvrebert

cvrebert commented on Mar 6, 2016

@cvrebert
Collaborator

@vanflymen It's a bug in the browsers themselves. We can't do anything about it on our end. It's already mentioned in our documentation as a known issue.

cvrebert

cvrebert commented on Mar 6, 2016

@cvrebert
Collaborator

If you want to follow its progress, the browser bug is https://bugs.webkit.org/show_bug.cgi?id=153852

g0dlight

g0dlight commented on May 3, 2016

@g0dlight

Just run into this bug, Here is my fix:

$('body').on('touchmove', function(e){
if($('.scroll-disable').has($(e.target)).length) e.preventDefault();
});
$('body').on('shown.bs.modal', function(){
$(this).addClass('scroll-disable');
});
$('body').on('hidden.bs.modal', function(){
$(this).removeClass('scroll-disable');
});

locked and limited conversation to collaborators on Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mdo@stefek99@cvrebert@dvf@felipe-canaviri

        Issue actions

          Modal scrolling on mobile devices - what is the current state? · Issue #15852 · twbs/bootstrap