WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
Bug 138201
Caret doesn't move while scrolling -webkit-overflow-scrolling: touch content on iOS
https://bugs.webkit.org/show_bug.cgi?id=138201
Summary
Caret doesn't move while scrolling -webkit-overflow-scrolling: touch content ...
Chris Rebert
Reported
2014-10-29 17:45:22 PDT
Original Bootstrap bug:
https://github.com/twbs/bootstrap/issues/14708
1. Open
http://jsbin.com/himir/2
in iOS 8 Safari. 2. Click the green button 3. Tap into the "First Name" text field 4. Place finger on part of the empty white background of the modal form box 5. Move your finger upwards so as to scroll the modal down, but don't take your finger off of the screen. Actual Result: Observe that the blinking blue text cursor remains at its original location before the scrolling began. Expected Result: Either the cursor should move along with the text field or it should temporarily stop being displayed altogether. This bug has been reproduced on iOS 7 and iOS 8.
Attachments
Copy of 1st JS Bin example
(3.33 KB, text/html)
2015-05-06 13:40 PDT
,
Chris Rebert
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Rebert
Comment 1
2014-10-29 17:55:52 PDT
Have also filed this as: <
rdar://problem/18819624
>
Chris Rebert
Comment 2
2015-05-06 13:40:02 PDT
Created
attachment 252514
[details]
Copy of 1st JS Bin example
Chris Rebert
Comment 3
2015-10-30 01:20:15 PDT
I am unable to re-test the testcase against iOS 9 since it's affected by
bug 150715
.
Chris Rebert
Comment 4
2016-02-07 16:40:47 PST
Updated testcase to avoid
bug 150715
.
Chris Rebert
Comment 5
2016-02-07 16:41:53 PST
I can't reproduce this in iOS 9.2.
Josh Pike
Comment 6
2016-02-08 19:16:21 PST
I can. Please reopen the issue. A good example of a site this issue occurs on:
https://material.angularjs.org/latest/demo/input
Issue occurs in Safari, WKWebKit view iOS 9.2.1
Chris Rebert
Comment 7
2016-02-08 19:32:53 PST
Interesting. Confirmed.
Josh Pike
Comment 8
2016-02-24 14:31:49 PST
Not one to be a nag, but I think this bug is a pretty serious usability issue. It's a deal breaker in creating SPAs for iOS, which is becoming an increasing trend. What is this issue most probably due to?
Josh Pike
Comment 9
2016-03-10 17:24:28 PST
Are there are any known workaround to this? It's driving me insane and my users are constantly complaining about it.
Carlos
Comment 10
2016-03-11 02:17:02 PST
I have spent some days trying to find a workaround without success. Here there is a gif when we can see the caret floating when scrolling
https://media.giphy.com/media/3o7abrmGRJeHg0PYZy/giphy.gif
Things I know: - still happening in iOS 9.3 - Only happens when the scroll is not in the body. Usually to have a fixed layer like a header. - Only happens when -webkit-overflow-scrolling: touch is activated (for able to scroll with momentum)
Chris Rebert
Comment 11
2016-03-11 02:24:03 PST
Carlos, could you post the URL of your JS Bin? Looks like it might be a simpler (and thus better) testcase than the current AngularJS one.
Carlos
Comment 12
2016-03-11 02:31:43 PST
http://output.jsbin.com/hoxuxu
http://jsbin.com/hoxuxu/edit?html,css,output
Also, here is another issue with the caret and scroll that maybe is related and can help.
https://stackoverflow.com/questions/35700636/input-caret-floating-over-a-fixed-layer-when-scrolling
Thanks
Josh Pike
Comment 13
2016-03-15 18:40:48 PDT
I should add: My input fields use transform3D(0,0,0) as a workaround to fix the safari disappearing fields bug:
http://stackoverflow.com/questions/9807620/ipad-safari-scrolling-causes-html-elements-to-disappear-and-reappear-with-a-dela
This may or may not be a contributing factor. It's incredible that this is still a problem!
Josh Pike
Comment 14
2016-03-15 18:42:47 PDT
I've run into it again in another scenario...
http://stackoverflow.com/questions/20737503/mobile-safari-input-caret-does-not-scroll-along-with-overflow-scrolling-touch
This issue needs WAY more attention.
Simon Fraser (smfr)
Comment 15
2016-03-15 18:47:52 PDT
(In reply to
comment #14
)
> I've run into it again in another scenario... > >
http://stackoverflow.com/questions/20737503/mobile-safari-input-caret-does
- > not-scroll-along-with-overflow-scrolling-touch
Did you file a bug on that issue?
Josh Pike
Comment 16
2016-03-15 18:48:41 PDT
In Apple's bug reporter? Yes. Months ago.
Simon Fraser (smfr)
Comment 17
2016-03-15 18:49:55 PDT
Can you comment with the bug number please.
Josh Pike
Comment 18
2016-03-15 18:50:48 PDT
24882755
Simon Fraser (smfr)
Comment 19
2016-03-15 19:01:14 PDT
(In reply to
comment #18
)
> 24882755
Thank you. I'll look into it.
Josh Pike
Comment 20
2016-03-15 21:29:13 PDT
Found a workaround! This workaround is partially in angular.js but should work with any JS framework (or pure JS). On tapping an input field, I used $location.hash to jump to the field above it straight after focus, which caused the input cursor to stay where it was. If I just trigger a .blur() then a focus() about 300-400 ms after the scroll jumped, the input cursor 'reset' its position to the correct one.
vitaly.kosenko
Comment 21
2017-07-18 04:27:19 PDT
Why do I still see error in Safari 10 on iOS 10.3.2 in
http://jsfiddle.net/gxT3w
. I'am setting focus and start scrolling
gabrielmaldi
Comment 22
2017-10-03 10:58:30 PDT
I can still repro this issue in UIWebView on iOS 11.1.
Simon Fraser (smfr)
Comment 23
2017-10-11 11:30:39 PDT
Does it reproduce in WKWebView?
gabrielmaldi
Comment 24
2017-10-12 19:20:39 PDT
(In reply to Simon Fraser (smfr) from
comment #23
)
> Does it reproduce in WKWebView?
Yes, it does. I just tested the following code on my iPhone 6S running iOS 11.1 beta 2: ``` WKWebView *webView = [[WKWebView alloc] init]; NSURL *url = [NSURL URLWithString:@"
https://jsfiddle.net/gabrielmaldi/n5pgedzv/show/
"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; ``` And this is the result:
https://youtu.be/KYBOEePlysk
Even though it repros in WKWebView, native web apps have no option but to use the older UIWebView because WKWebView doesn't handle local files well (and a web server is needed). So it would be great if this issue got fixed and also backported to UIWebView. Thanks
Not Internet Explorer
Comment 25
2017-10-16 07:59:38 PDT
How is this issue not resolved yet? Seriously. As carlos already issued at 2016-03-11 (WTF): - still happening in iOS 9.3 - Only happens when the scroll is not in the body. Usually to have a fixed layer like a header. - Only happens when -webkit-overflow-scrolling: touch is activated (for able to scroll with momentum)
Simon Fraser (smfr)
Comment 26
2017-10-17 20:52:43 PDT
With both UIWebView and WKWebView on iOS 11, I can reproduce the caret remaining visible when scrolling on
https://jsfiddle.net/gabrielmaldi/n5pgedzv/show/
. However, in both cases when the scroll ends the caret snaps to the correct location.
Simon Fraser (smfr)
Comment 27
2017-10-17 20:58:19 PDT
We need to track when the caret is inside accelerated overflow scroll and just hide it while scrolling, as we do inside position:fixed (see -shouldHideSelectionWhenScrolling).
Hans
Comment 28
2017-11-08 13:45:02 PST
It has been quite a while since this bug was reported is there an ETA for a fix? While this bug does not prevent the user from inputting using the onscreen keyboard it does break the expected user interaction and I believe it should be considered a P1.
Jon M
Comment 29
2017-11-29 15:23:23 PST
Would love for this bug to get some attention. Our users complain about it due to not knowing where text is going to get entered until a user starts typing or performs another action on the site.
gabrielmaldi
Comment 34
2018-08-22 17:49:10 PDT
Just confirmed the issue exists in iOS 12 developer beta 9, running on my iPhone X using Xcode 10 beta 6. Same code and behavior (YouTube video) I posted in [
Comment 24
](
https://bugs.webkit.org/show_bug.cgi?id=138201#c24
) for both WKWebView and UIWebView.
Chet Corcos
Comment 35
2018-10-16 16:41:47 PDT
I'm having this same issue. Looks like a native re-rendering problem. If I listen to the "scroll" event and change `paddingBottom = Math.random() + "px"` causing a re-render, then the caret moves. The view also janks around though too. Not a solution, just a demonstration. Please fix this Apple! :)
Chet Corcos
Comment 36
2018-10-16 17:03:24 PDT
I have a really hacky solution that appears to work in the meantime. It takes a toll on performance though :/ ``` import * as raf from "raf" let elm: HTMLDivElement | undefined function getElm() { if (!elm) { elm = document.createElement("div") elm.style.position = "fixed" elm.style.top = "-9999px" elm.style.left = "-9999px" elm.style.zIndex = "-9999" document.body.appendChild(elm) } return elm } let pendingRender = false function forceRerender() { if (pendingRender) { return } pendingRender = true raf(() => { pendingRender = false getElm().style.height = Math.random() + "px" }) } function rerenderSelectionCaret() { if (window.getSelection().anchorNode) { forceRerender() } } // get your scroller element scroller.addEventListener("scroll", rerenderSelectionCaret) ```
Mato
Comment 37
2018-11-07 03:19:28 PST
In our case, this even prevented form field values from being rendered. You can see the caret moving but no text is shown. Querying the field's value properly returns the entered text. By forcing a re-render, e.g. by changing CSS properties of the field, the value is rendered then. This is really a major issue. We've tested it on the latest versions of iOS 11 and 12. Removing "-webkit-overflow-scrolling" solves the rendering issue but sacrifices UX.
Mato
Comment 38
2018-11-07 03:26:26 PST
(In reply to Mato from
comment #37
)
> In our case, this even prevented form field values from being rendered. You > can see the caret moving but no text is shown. Querying the field's value > properly returns the entered text. By forcing a re-render, e.g. by changing > CSS properties of the field, the value is rendered then. > > This is really a major issue. We've tested it on the latest versions of iOS > 11 and 12. Removing "-webkit-overflow-scrolling" solves the rendering issue > but sacrifices UX.
An additional information I forgot to mention is, that we're experiencing this issue in both, Safari and WkWebView.
Simon Fraser (smfr)
Comment 39
2018-11-07 10:45:58 PST
(In reply to Mato from
comment #37
)
> In our case, this even prevented form field values from being rendered. You > can see the caret moving but no text is shown. Querying the field's value > properly returns the entered text. By forcing a re-render, e.g. by changing > CSS properties of the field, the value is rendered then.
That sounds like a separate issue. Can you file a new bug with a test case?
Piotr
Comment 40
2019-10-25 00:18:16 PDT
Still experiencing this in iOS 13.1.3 in WKWebView and Safari. Haven´t been able to find any workaround. Tried using the scroll event to hide the caret, re-rendering the field by setting value to something else and then back again on scroll did help a little bit but broke the bouncy scroll. So stuck with a glitchy app.
peter.koshelev
Comment 41
2022-03-10 10:13:52 PST
any solution for this!?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug