iPad modal <select> bug #14975

Closed
ghost opened this Issue Nov 3, 2014 · 18 comments

5 participants

@ghost
ghost commented Nov 3, 2014

When popping up a modal on a page that is scrolled down, then opening a <select> within the modal, the page jumps up. All elements on the modal are shifted in a way that they no longer line up with the actual visuals. It's tough to explain, so I put together a demo:

https://github.com/CaptSaltyJack/bootstrap-select-bug

Once it's broken and the modal button and dropdown no longer work, try tapping slightly above them. You'll see what I mean about the touch areas being displaced. Once you scroll to the top of the page, the modal elements work again as expected.

@hnrch02
Bootstrap member
hnrch02 commented Nov 3, 2014

Can you break that example down into simpler form hosted on preferably JS Bin?

@ghost
ghost commented Nov 3, 2014

How much simpler should it be?

@hnrch02
Bootstrap member
hnrch02 commented Nov 3, 2014

The bare minimum to reproduce the bug.

@hnrch02
Bootstrap member
hnrch02 commented Nov 3, 2014

You can just put all the code necessary into the Bin, haven't really looked at the repo you posted. Just something I can open in a browser without needing to clone it onto my filesystem.

@cvrebert cvrebert changed the title from Major bug found on mobile devices (iOS) to iOS modal <select> bug Nov 3, 2014
@cvrebert
Bootstrap member
cvrebert commented Nov 3, 2014

Are you using iOS 8.1? Are you using an iPhone, or an iPad?

@ghost
ghost commented Nov 3, 2014

Will put up a demo link ASAP.

I'm using an iPad, iOS 8.1. But it's broken on the iPhone as well.

@ghost
ghost commented Nov 3, 2014

Demo: http://jsbin.com/furivihaho http://output.jsbin.com/jinuda/1

And source code is in the repo mentioned in my first post.

EDIT: Corrected syntax error in code.

@carasmo
carasmo commented Nov 3, 2014

Works fine in IOS 8 Safari 8 on iPhone. I scroll all the way down, then go back to the top, launch the modal, click the select, click done, then I can still use all the buttons and reselect the select.
I think what you're seeing is the way IOS automatically zooms the page and messes up the layout once you focus an input.

See if it happens here: http://jsbin.com/nureqa

@ghost
ghost commented Nov 3, 2014

Make sure you follow the instructions. Scroll all the way to the bottom, THEN launch the modal. Do not scroll to the very top until you want to stop the symptoms.

@ghost
ghost commented Nov 3, 2014

And yes, your version also exhibits the bug.

@ghost
ghost commented Nov 3, 2014

What seems to happen is that when the page is scrolled down and you open a select menu within a modal, it jumps the page and the visual layout on the screen no longer physically lines up with the touch hotspots.

@carasmo
carasmo commented Nov 3, 2014

I did read about the "The vertical Position of the touch is not passed correctly to Safari" at this answer link http://stackoverflow.com/a/26349227/1004312. I had things working fine in IOS 7 but in IOS 8 you couldn't click until you scrolled to the top (even though it was on the top). It was odd.

@ghost
ghost commented Nov 3, 2014

Hmm. Well, this is way above my head, so I'll leave it to smarter people to figure this one out. As a workaround, I'm going to have to ditch using such form controls within a modal.

@mdo
Bootstrap member
mdo commented Nov 9, 2014

This is actually an iOS problem no? It sounds super familiar to the keyboard being triggered when the modal is open. The same thing occurs—a fixed position element (the modal) is in the viewport, then something iOS-related is triggered (<select> options or keyboard) and the onscreen content is moved.

Do we close as an iOS fixed position problem?

@cvrebert cvrebert added the browser bug label Jan 8, 2015
@hkailantzis

had same problem in one of our projects. setting oveflow:hidden and position:fixed to the body (to really disable page scrolling in iOS), seems to solve it, in my case. Although posision:fixed will scroll the page to the top. iPad Mini, iOS 8.4. Looks like iOS/Safari issue still.

@cvrebert cvrebert added the v3 label Aug 19, 2015
@cvrebert cvrebert self-assigned this Oct 9, 2015
@cvrebert cvrebert changed the title from iOS modal <select> bug to iPad modal <select> bug Oct 12, 2015
@cvrebert cvrebert added the confirmed label Oct 12, 2015
@cvrebert
Bootstrap member

Was able to reproduce this on Sauce Labs in the iPad simulator running iOS 8.4.
iPad uses a different <select> menu widget than iPhone, and I couldn't manage to repro this on an iPhone.

@cvrebert
Bootstrap member

Still repros with iOS 9.0 and iOS 9.1 beta.

@cvrebert
Bootstrap member
@cvrebert cvrebert removed their assignment Oct 13, 2015
@cvrebert cvrebert added a commit that referenced this issue Oct 13, 2015
@cvrebert cvrebert Port #17906 to v3
Add Wall of Browser Bugs entry for #14975
See https://bugs.webkit.org/show_bug.cgi?id=150079
Closes #14975
[ci skip]
a0b8cb7
@cvrebert cvrebert added a commit that closed this issue Oct 13, 2015
@cvrebert cvrebert Port #17906 to v3
Add Wall of Browser Bugs entry for #14975
See https://bugs.webkit.org/show_bug.cgi?id=150079
Closes #14975
[ci skip]
a0b8cb7
@cvrebert cvrebert closed this in a0b8cb7 Oct 13, 2015
@cvrebert cvrebert added this to the v3.3.6 milestone Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment