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

Body jumps when activating a modal in iOS #32

Closed
kaskajp opened this issue May 14, 2013 · 13 comments
Closed

Body jumps when activating a modal in iOS #32

kaskajp opened this issue May 14, 2013 · 13 comments
Assignees
Labels
Milestone

Comments

@kaskajp
Copy link

kaskajp commented May 14, 2013

Every time you activate a modal, the page jumps down.

iOS 6.1.4

@drublic
Copy link
Owner

drublic commented May 14, 2013

Thanks for reporting. This is related to #31 and I will try to find a working solution.

@anselmh
Copy link
Contributor

anselmh commented May 21, 2013

This also applies for Android Chrome and Opera 14.

@drublic drublic mentioned this issue Jun 4, 2013
@anselmh
Copy link
Contributor

anselmh commented Aug 13, 2013

As all related issues are closed, what's the status here?

@mkkwon
Copy link

mkkwon commented Aug 23, 2013

Same here. Just posting to bump this thread and check the status of this. Apparently it also happens in the Chrome iOS app.

iOS 6.1.2

@mkkwon
Copy link

mkkwon commented Aug 23, 2013

There is a workaround for this,.. Sorta. Make the anchor href link for "Close" button to href="#page" and then set the body's id to "page". The close button will serve as an anchor link to redirect users to the top of the page. This pattern is seen in lukew.com, with his navigation serving as bottom anchor links that also has a link redirecting to the top.

However it does not address the main issue of modal triggering page jump, so the issue should still remain open.

@jme783
Copy link

jme783 commented Oct 18, 2013

Does anyone have a way to prevent this mkkwon's solution works for closing the modal but what about opening it?

@jme783
Copy link

jme783 commented Oct 21, 2013

Has anyone discovered a workaround for this issue that they can share here? The page jump for iOS is creating other issues that are causing breakages in the style, especially on changing orientation from portrait to landscape.

Help would be greatly appreciated.

@anselmh
Copy link
Contributor

anselmh commented Oct 21, 2013

Have you guys checked out branch wip-1.1.0 yet? This issue should be fixed already in the upcoming release. You can use this branch's code already although not all tasks for 1.1 have been finished.

@jme783
Copy link

jme783 commented Oct 21, 2013

Just tried the new modal.css and modal.js files for this branch. Still seeing this issue.

@anselmh
Copy link
Contributor

anselmh commented Oct 21, 2013

@jme783 Thanks for reporting back. Then we need to investigate further here +@drublic.

@jme783
Copy link

jme783 commented Oct 21, 2013

No problem. Just let me know if/when there is a fix. I'll try to hack something in the intermediary

@anselmh
Copy link
Contributor

anselmh commented Oct 21, 2013

It would be great if you could write down your working hack here then, so others can profit from it, too. :)

@jme783
Copy link

jme783 commented Oct 23, 2013

Here's what I did to prevent this from happening on my end. It's not ideal, but the page jump doesn't happen. I think the key is the fact that position:fixed is used for the modal.

If the user loads the page with the modal hash, remove it so the page doesn't jump.

var hash = window.location.hash;
if (hash == "#lf-widget-modal") {
  window.location.hash = "";
}

Also change the position of the semantic content div, modal inner, and modal close to absolute for mobile devices

@media screen and (max-width: 30em) {
    .semantic-content, .semantic-content .modal-inner, .semantic-content .modal-close {
    /* styles */
    position: absolute;
 }

This gets rid of the nice slide up animation of the modal for mobile, but it was a price I had to pay to prevent the page jump.

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

No branches or pull requests

5 participants