iOS: qTip position is incorrect, offset by scroll and viewport adjustment #74
Comments
Can you possibly post the user agent string for the iPhone you're using? I'll need to update the UA RegExp to match iOS 3.2 for iPhones too! |
Hoping this is now fixed in the latest commits. Let me know! |
Sorry Craig - I missed the email notifying me of your reply. The iPhone in question has the UA: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16" And a quick test seems to indicate that it is indeed fixed! Awesome. |
Just a note that this appears to have been broken again for the iPhone only. |
Your regular expression for matching was udpated on the 16th to "[0-9_]{3}" for the version number, but my user agent above doesn't match that. "[0-9_]{2}[0-9]" would. Wonder if it's that simple? |
I adjusted the regex to [0-9]{2,3}, did that help? |
I misspoke earlier about the regex ... (Github ate my and your underscores in the regex, so I think I was just confused :) The original one did match, though it would have yielded 3_ instead of 3_1 like it does now with your revision, so having that may be helpful anyway. In any case it seems like it would be setting the iOS variable properly, but it still is exhibiting the behavior of being offset by the scroll and the viewport on the iPhone. I'm waiting for my iPad to charge so I can test to verify that this still only affects the iPhone. |
Nope, confirmed just now that this particular issue of offset/viewport scrolling only effects the iPhone. |
Hmmm well looking at the regex it matches your iPhone as 3.1, which will (or at least should) cause the scroll of the document to be removed.... this is odd.. |
I decided on a hunch to test on my wife's iPhone, which is running iOS 4.2.1, and it works properly! Emptied my iOS 3 phone's cache, history, cookies and still no luck. It appears that this could be an issue with iOS 3.x. Ugh. Strange thing is that when you posted the fix originally, it was working on my iOS 3 phone (I distinctly remember testing it because I spent some time on my phone checking it out afterwards). I've not upgraded or change the phone since. |
Since I was in testing mode, I thought I'd revert my qTip to the older builds just to find out where the regression occurred and to make sure I wasn't going crazy :) I Updated to the March 8th build that I originally tested: "Date: Tue Mar 8 21:20:42 2011 +0000" and sure enough, it positions correctly on all my iOS devices. So I started on the path to find the regression and updated to the very next revision: "Date: Tue Mar 8 22:04:23 2011 +0000." This update broke the positioning on my iOS 3.1.2 iPhone, but not the iOS 3.2 and 4.2.1 devices! The only difference between the builds was the iOS regular expression. In the build where it works on all devices, the regular expression only matches 3.2 and 4.0:
In later builds the regular expression matches all two-digit+ versions, although the full expression only signifies versions less than 4.1 as iOS:
If I simply take the latest April 4th build and set iOS to "false" rather than parse the user agent, here's what I get:
Obivously, 3.2 (actually 3.1.3, see below) is where the exception begins and (probably) ends with 4.2. Unfortunately, I can't test more finely grained for you, but I can at least offer my best guesses based on the revision history about what the iOS var must evaluate to for it to position correctly:
Hope all that at least gives you some help. |
Hmm perhaps it would be worth including 3.1 in the fix also? |
Probably. Seems to reason that the 3.1 minors should all be relatively similar. |
Now that we can re-open issues, I figured I'd open this one since it's an ongoing issue. Unfortunately, the Github upgrade also made a mess of my version table above :( |
Hmm I reverted the regex back to the old (3_2|4_0) test. Hopefully this will fix the issue in the majority of cases? |
I think that this is mostly resolved :) but there are a few big lingering issues, including the one with modal tips on all versions of iOS I briefly mentioned on issue #103. I'm going to do a brief video to illustrate these for you, but specifically they are:
The last two of those might be resolved by simply removing the scrollLeft adjustment we added for the fixed modal dialogs in issue #103, but I'm not sure what that would mean for containing elements that have horizontal scrollbars. I also haven't yet tested a 'shift vertical' adjusted tip, but I suspect it might do the same thing (though we can't get rid of that scrollTop adjustment as it affects other tips in iOS) :/ |
See the video descriptions for information on what you're seeing in both these videos. Illustrating the first two bullets: http://www.youtube.com/watch?v=lXhq6BVJljk And this one illustrates the last bullet: http://www.youtube.com/watch?v=Iy-d5eAqPFM As I mentioned, this is happening on all versions of the iOS I am testing with (3.1.2/iPhone, 3.2/iPad, 4.2.1/iPhone). |
The first issue seems like a side-effect of the ipads pinch and zoom implementation... not sure if we can do much to mitigate that? As far as I know there isn't a way to test for the zoom level... The second one looks like it might actually be a cross-browser issue with the shift method... will look into this! |
The shift behavior illustrated up there doesn't happen in any desktop browser... only in iOS, so I'm not so sure. I think it also relates to the scrollLeft problem that I mentioned before. I tried removing the left adjustment for iOS that we added in issue #103 (left: !fixed || PLUGINS.iOS ? viewport ...), but it didn't seem to have any effect, so there must be something more subtle going on here. |
Hmm wondering if the new adjustment system has fixed this now? |
Nope, sorry :( Still seems essentially the same. Though if I zoom out, it does reposition itself correctly. It's definitely the zoom level that is affecting it as I postulated before and stems from the two viewports (layout and visual) that are present on mobile devices. When zoomed all the way out, both layout and visual viewports are the same. But as you zoom, the visual viewport changes, which is where the extra offsetting must be coming into play. QuirksMode.org has a ton of additional information that might be of help if you haven't already seen it. The page mentions a method for figuring the zoom level but also says it's unnecessary and gives specifics: |
I wonder if this is now fixed with the related changes to the adjust.shift method? The infinite scroll bug definitely seems like it should be! |
Nope. The bug remains. The issue is that qTip thinks that the viewport is changing size (getting larger) when you are zooming in. In other words, when you zoom, the qTips reposition themselves as if the page has gotten wider and taller. And as the quirksmode article hints, it is probably due to confusion between the viewports:
It goes on to describe how the measurements for each are derived on mobile devices:
It also notes the scrolling offset:
|
Hmmm this could get complicated since there's just not enough support for the window.innerHeight/Width :/ I just hada quick test of these properties on my Android device and it exhibits the same behaviour, but doesn't support the inner properties... bummer. I wonder... what happens if you change the $(window).height()/width() calls to use window.innerHeight/Width instead in core.js?
|
Changing it to the following:
Fixes the issue for modal dialogs on iOS and it seems to work great! Doesn't appear to have any effect on the growing window width issue though. I'm guessing I'd have something else to change for that... Edit: The compatibility chart on quirksmode seems to indicate that at least webkit on android does support window.innerwidth/height. Unless i'm misunderstanding or something: http://www.quirksmode.org/m/w3c_cssom.html Test page: http://www.quirksmode.org/dom/tests/windowview.html#innerWidth%20and%20innerHeight Edit again: Found this interesting tidbit that mentions that if you set the viewport for Android, it fixes an issue with Android's innerWidth/Height measurements: http://notes.kylebarrow.com/a-workaround-for-androids-broken-viewport |
I'm going to set this as closed now, since there isn't anything else I can do to fix the remaining scroll-port issues in Android, as adding meta tags etc should be done by the user. |
Originally posted in the forums, but it got bumped off the first page and doesn't appear to have been addressed, so moving here.
Edit: Since this was reported, I've discovered other related issues that occur in iOS 3.2 (iPad) and iOS 4.2.1. See below.
This issue appears to be limited only to the iPhone and does not seem to occur on the iPad, but it is similar to the issue reported previously for the iPad:
When initially viewed on the iPhone, qTips triggers "above the fold" (ie. before scrolling) position correctly. However, when the page is scrolled, all tooltips become offset by the scroll amount. Scrolling back to the top fixes the position for triggers that are visible above the bottom of the window.
Also, as the viewport is changed on the iPhone (for example, by zooming into a portion of the page), all qTips shift themselves into incorrect positioning. Zooming back out to the full original viewport shifts them back into proper position.
Scrolling AND adjusting the viewport causes the tips to shift up by the scroll amount and also to the left/right/up/down based on the viewport zoom.
Are the fixes you put in place for the iPad limited specifically for the iPad, Craig? It seems like the fixes applied for the iPad bug would resolve this issue for the iPhone.
The text was updated successfully, but these errors were encountered: