Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction

Showing 1-23 of 23 messages
Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction dp_Lewis 3/4/12 1:48 PM
Hi there,

I'm experiencing a strange problem when I use -webkit-overflow-
scrolling: touch within my app.

Within my app I use this to allow people to scroll up and down through
the contents of a story (like The Onion), this works perfectly  90% of
the time, but sometimes the scrolling will want to go left and right
(even though you're gesturing to go up and down).

If you've experienced this you'll know exactly what I mean.

At the moment I'm trying to produce a stand alone demo of this
problem, but without knowing the root cause it's a little hard.

Has anyone else experienced this?

This post on stack overflow seems to be something similar:

http://stackoverflow.com/questions/7992952/issue-with-scrolling-in-ios-5-using-webkit-overflow-scrolling

And I'd really like to contact that user to get their code as an
example, but there's no way to contact someone directly... and my post
on that question was deleted as it was seen as being another question :
(

Help me prove my sanity :)
David
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction dp_Lewis 3/4/12 8:10 PM
As a follow up to this I've managed to put together the following
demo:

http://bit.ly/wTrPFs

The problem is most apparent in iPad 1, but iPad 2 seems to have
problems with the scrolling too (looks like it freezes).

Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Kerri Shotts 3/4/12 8:16 PM
phoneGap does use an IFRAME to do communication between the native and js layer, so that may be contributing to the issue. (Going by the reply on the SO question above.)

I've had a similar issue: that is, that when attempting to use native scrolling, one half of the screen would scroll correctly (say, the left side), and the right side would scroll in the reverse direction (that is, if the intended direction was to swipe DOWN to scroll UP, the iPad would instead scroll DOWN. Very disconcerting feeling). I also noticed that swiping in odd directions also produced aberrant behavior where the scroll would not be in the appropriate direction.

This was the latest thing that skewered my attempt to go to native scrolling in my app, so I had to go back to iScroll. So far, save for (perhaps) apps with simple layout, it seems native scrolling is a bust when it comes to using html+js+css behave like an app. Which is too bad.... :-( 
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction dp_Lewis 3/4/12 8:39 PM
Thanks for the reply Kerri.

Your scrolling problems sounds just as mad as mine!! :)

Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction TimW 3/8/12 3:44 PM
For what it's worth, you can avoid using the internal PhoneGap iframe.  I made the following change to phone gap-1.4.1.js (the version I happen to be using):

    if (PhoneGap.commandQueue.length == 1 && !PhoneGap.commandQueueFlushing) {
        /*if (!PhoneGap.gapBridge) {
            PhoneGap.gapBridge = PhoneGap.createGapBridge();
        }

        PhoneGap.gapBridge.src = "gap://ready";*/
        location = "gap://ready";
    }

Essentially rather than create the bridge iframe (which is just used for signaling native code) I change the actual location of the current window.  However, native code disallows this change, so the location never really changes.  The signal still get's through though.

Works for me as they say, and I now get to use the touch scrolling again.


On Sunday, March 4, 2012 8:39:23 PM UTC-8, dp_Lewis wrote:
Thanks for the reply Kerri.

Your scrolling problems sounds just as mad as mine!! :)

Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Shazron Abdullah 3/8/12 4:29 PM
Not using the iframe for the bridge may cause side-effects however
since the primary reason we went that route is for reliable use of
setting html code through the innerHTML property of a DOM element.

http://blog.johnmckerrell.com/2007/03/07/problems-with-safari-and-innerhtml/

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com

Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction TimW 3/10/12 11:22 AM
It wasn't my first choice as a workaround.  Initially tried using an image to trigger the gap: protocol, but that didn't work.  Didn't try XMLHttpRequest.

Be nice if Apple just fixed it of course, since I wanted to do YouTube embeds but obviously can't since they use iframes too.
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Eric Blade 3/11/12 12:03 PM
I'm guessing that there are some significantly wrong things going on
with calculations in the webkit somewhere -- I've tried at least a
half-dozen different javascript scrolling methods, and on both iOS and
Android they will all exhibit the same "goes the wrong direction for
no obvious reason" thing sometimes.

On Mar 10, 2:22 pm, TimW <tim.j.wilkin...@gmail.com> wrote:
> It wasn't my first choice as a workaround.  Initially tried using an image
> to trigger the gap: protocol, but that didn't work.  Didn't try
> XMLHttpRequest.
>
> Be nice if Apple just fixed it of course, since I wanted to do YouTube
> embeds but obviously can't since they use iframes too.
>
>
>
>
>
>
>
> On Thursday, March 8, 2012 4:29:10 PM UTC-8, Shazron Abdullah wrote:
>
> > Not using the iframe for the bridge may cause side-effects however
> > since the primary reason we went that route is for reliable use of
> > setting html code through the innerHTML property of a DOM element.
>
> >http://blog.johnmckerrell.com/2007/03/07/problems-with-safari-and-inn...
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Thai Rath 4/24/12 10:31 AM
I am seeing this issue very frequently; even on Mobile Safari.  Has
there been any updates on this issue?  Is Apple going to fix this bug?
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction joafeldmann 5/22/12 2:05 AM
Thanks, this stops scrolling issues and related issuses (see: https://groups.google.com/forum/?fromgroups#!topic/phonegap/eYcoMaWx3bA)  for me in Cordova 1.7.0 as well. 

@Shazron: What side-effects may occur?


Am Freitag, 9. März 2012 00:44:39 UTC+1 schrieb TimW:
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction dp_Lewis 6/4/12 12:04 AM
This solution worked for me too :)

Had the problem reoccur in a new project.

No side effects yet, but I'll keep my eye out.

Thanks a million!
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction gaurav bajaj 6/12/12 12:42 PM
This breaks my app on iOS 4.3.
Has anyone tried it on this version?

-Gaurav
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction David Pardo 6/18/12 3:56 AM
Thank you so much. I spent three whole days looking for a solution until I found your post. 
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Greg 7/26/12 11:57 PM
I believe I came across side effects. I have noticed that at some point cordova stops flushing command queue.
I used iWebInspector to check the cordova object. The cordova.commandQueueFlushing property was equal to false. However, cordova.commandQueue array was not empty. It's length was greater than 1. Obviously, the condition around line #969 in cordova.js was never evaluated to true. It started working again once I set cordova.commandQueue to an empty array.

I use cordova 2.0. But I've noticed this problem in 1.7. I was never able to reproduce this problem with iframe. Without iframe it happens at some point. I can't figure out the exact conditions. It seems like there is a thread race condition between native side and javascript. The problem started occurring when hooked up google analytics plugin. And only when I track "tap" event (I use zepto.js).

- Greg

On Monday, June 4, 2012 12:04:34 AM UTC-7, dp_Lewis wrote:
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Greg 7/28/12 10:30 AM
I have done some additional testing. It looks like google analytics plugin has nothing to do with this problem. Command queue just stops flushing at some point. The only thing that I've noticed that the chance it stops working is higher when I have very frequent calls to the native code. I output lots of debug info to the console and whenI minimized the number of calls to the console.log, the problem seems to disappear.

Perhaps, some of the cordova developers could explain the "if" statement on line #967 of cordova.ios.js:
Why (cordova.commandQueue == 1) and not (cordova.commandQueue >= 1)?
Is there a chance of executing the same command multiple times?

Thanks,
- Greg
Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction raulc 8/15/12 1:54 PM
hi,

i also was experiencing some strange effects with -webkit-overflow-scrolling.
mostly was working, but when switching from a div to another, each 4-5 times the scroll in the 2nd div just froze.

the solution to not use the bridge was working, but i did not want to go that way, since the side effects were not clear.

so what seem to have fixed it for me was, in cordova.js (i am using 2.0.0), in the function createGapBridge, i set the following property on the newly created ifram:

        gapBridge.setAttribute("-webkit-transform","translate3d(0px, 0px, 0px)");

hope that helps,
Raul.

Am Sonntag, 4. März 2012 22:48:42 UTC+1 schrieb dp_Lewis:
Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Kerri Shotts 8/15/12 8:06 PM
Surprised that does the trick! I wouldn't have thought of attaching the attribute to the gap bridge. Nice Find.

______________________________
Kerri Shotts
photoKandy Studios LLC

📱 Phone: +1 (312) 380-1035
🌐 Web: http://photokandy.com 

Twitter: @photokandy

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

To compile in the cloud, check out build.phonegap.com


Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Kerri Shotts 8/15/12 8:08 PM
Okay, hold on a second... you're actually setting an attribute, not adjusting the style on that iframe, so I'm surprised this does anything at all.

I wonder if just setting any attribute on the iframe works? What if you set an attribute of an obviously non-existent attribute, eg:

gapBridge.setAttribute("blahblah","blah");

Does that continue to fix the problem, or does the problem return?


______________________________
Kerri Shotts
photoKandy Studios LLC

📱 Phone: +1 (312) 380-1035
🌐 Web: http://photokandy.com 

Twitter: @photokandy


On Aug 15, 2012, at 15:54, raulc <raulci...@gmail.com> wrote:

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com

To compile in the cloud, check out build.phonegap.com


Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Greg 8/15/12 9:06 PM
I've using the following workaround:
    var gapInterval = null;
    createGapBridge = function() {

        gapBridge = document.createElement("iframe");
        gapBridge.setAttribute("style", "display:none;");
        gapBridge.setAttribute("height","0px");
        gapBridge.setAttribute("width","0px");
        gapBridge.setAttribute("frameborder","0");
        document.documentElement.appendChild(gapBridge);

        if (gapInterval === null) {
            gapInterval = window.setInterval(function() {
                if (cordova.commandQueue.length === 0 && cordova.commandQueueFlushing === false) {
                    if (gapBridge) {
                        gapBridge.parentNode.removeChild(gapBridge);
                        gapBridge = null;
                    }
                    clearInterval(gapInterval);
                    gapInterval = null;
                }
            }, 500);
        }
    }

It was suggested by one of the cordova devs.

FYI:
Not using iframe at all is dangerous as webkit may skip navigation to "gap:ready" url in case such requests come very fast one after another. That's why cordova uses iframe.
Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction raulc 8/16/12 4:54 AM
sorry that did not work.
you are right.

it just did not create the iframe, so all the problems with the scrolling where gone
however phonegap did not work anyme :)

sorry for posting too soon.

Am Donnerstag, 16. August 2012 05:08:54 UTC+2 schrieb Kerri Shotts:
Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction raulc 8/16/12 11:11 AM
i have managed to get it working, however using a solution that is not related to phonegap.

my problem was that i had different divs, only one shown at the time.
the divs have scrollable content - which just froze regularly..

the solution that worked for me was to not hide the hidden divs (display: none;) but rather take them offscreen (-webkit-transform: translate3d(350px, 0px, 0px);)



Am Donnerstag, 16. August 2012 13:54:05 UTC+2 schrieb raulc:
Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Giovanni 11/7/12 8:10 AM
Hi all,
this does not work for me on iPad iOS 5.1.1.
Removing the gap bridge when the queue is empty does nothing.
The reverse scrolling appears as soon as I append an iframe into the dom.
Re: [PhoneGap] Re: Using -webkit-overflow-scrolling: touch sometime scrolls in the wrong direction Kerri Shotts 11/7/12 2:19 PM
Yeah, don't add an iframe into the DOM -- that's what causes the issue. /Any/ iframe can cause the behavior.

I don't know if Apple has ever fixed it -- I just avoid iframes whenever possible anyway, and since the newest version of PG no longer uses the iframe as the bridge by default, it's safe to use native scrolling on iOS as long as you don't add any other iframes into the mix. 

Not to say that there aren't other funky glitches with native scrolling, but c'est la vie, I guess.

______________________________
Kerri Shotts
photoKandy Studios LLC

📱 Phone: +1 (312) 380-1035
🌐 Web: http://photokandy.com 

Twitter: @photokandy

More topics »