ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Cursor does not follow input when scrolling with $ionicScrollDelegate on iOS

Open AgDude opened this issue 12 years ago • 16 comments

This is the same problem as described in #26 and #1063. It seems that it was fixed for scrolling by the user, but if the scroll is done programatically the problem still occurs.

here is a snippet from a directive:

var scroller = $ionicScrollDelegate.$getByHandle('my-handle'),
      setTop = function(){
        var top = element[0].getBoundingClientRect().top;
        if ( top > 62){ scroller.scrollBy(0, top - 62, true); }
      };

When setTop is called, the scroll happens, but cursor stays in the original position (no longer over the input).

AgDude avatar Sep 19 '14 11:09 AgDude

Hi, just upgraded to beta14. This fix screws up my chat app that where the selected input is outside the scroll area (in a footer). By screws up I mean: removes focus from the input. Even better because I hook into onBlur events and setFocus i get into an infinite loop. IMHO blurring of activeElements would be better achieved as a directive rather than on the raw scrollDelegate API which should just do what it says on the tin (manage the scroll area).

sloops77 avatar Dec 29 '14 09:12 sloops77

I agree with @sloops77, I have a chat-based app and have the exact same problem with this fix

cquartier avatar Jan 10 '15 22:01 cquartier

@sloops77 can you please share the solution in codepen?

pulakb avatar Jan 13 '15 08:01 pulakb

Unfortunately the way i've fixed this is by using a fork of ionic (or hack your copy of ionic).

see this commit on my own fork https://github.com/sloops77/ionic/commit/c96af221a7c4edb68a91a867c4663c1efa23fb4e. you can cherrypick it if u like.

Note that my fork of ionic also contains commits for trigger.io support which you probably dont want

sloops77 avatar Jan 21 '15 13:01 sloops77

@AgDude Would you be able to put together a codepen replicating the issue? Thanks

adamdbradley avatar Feb 12 '15 17:02 adamdbradley

Greetings @AgDude!

My sensors indicate a reply was requested, but we have not received one yet, I am using my robot powers to close this issue. However, if you are still experiencing this issue, please feel free to reopen it by creating a new issue, and include any examples or necessary information.

Thank you for allowing me to assist you.

Ionitron avatar Mar 19 '15 04:03 Ionitron

I am facing the exact same issue. Is there a solution for this yet?

kunj77 avatar Jan 13 '16 08:01 kunj77

I am facing this same issu in android. Any solutions?

Stephs15 avatar May 16 '16 16:05 Stephs15

Any update on this??? I am facing the exact same issue in iOS...

piyushmanurkar avatar May 30 '16 07:05 piyushmanurkar

Same here with ionic 1.3 and iOs 9.3...

VinceOPS avatar Jun 09 '16 17:06 VinceOPS

Hi there! Just to say that the issue also exists on Android with overflow-scroll set to false

VinceOPS avatar Sep 19 '16 10:09 VinceOPS

same issue with iOS 10 and ionic 1.3

jdnichollsc avatar May 10 '17 21:05 jdnichollsc

I faced the same issue in all ios devices with ionic 1

ManivannanP avatar Jul 26 '17 10:07 ManivannanP

Looks like it's a bug from webkit in Safari mobile: https://bugs.webkit.org/show_bug.cgi?id=138201#c5

(http://openradar.appspot.com/18819624)

It will probably never be fixed (lasting since iOS 7). The only workaround (given by the community) seems to consist in hiding the cursor by triggering blur(), and then focusing again (focus()) when scroll is done...

VinceOPS avatar Jul 26 '17 10:07 VinceOPS

I am facing the same issue.The input field cursor scroll with screen in IOS device in ionic 1 and IOs 10. Unable to find any solution.Please help as soon as possible.

Thanks in advance.

JaswinderImmanent avatar Sep 14 '17 18:09 JaswinderImmanent

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Sep 02 '18 02:09 ionitron-bot[bot]