Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I properly position a cursor on IOS11 Safari in popup forms?

After we upgraded my iPhone to IOS11, I started seeing a cursor in a random position in my login window. This also happens on Chrome / IOS11. The position of the cursor is marked red on screenshots below.

Login screen with misplaced cursor

Another screen with the same problem

like image 448
mkvakin Avatar asked Sep 23 '17 17:09

mkvakin


2 Answers

Try adding position: fixed to the body of the page.

like image 123
Ignacio Ferro Avatar answered Oct 31 '22 07:10

Ignacio Ferro


Piggybacking off of ybentz's answer. If you use the bootstrap modal, you can add this to your main.js file:

 var savedScrollPosition;

 $(document).on('show.bs.modal', '.modal', function() {
     savedScrollPosition = $(window).scrollTop();
 });

 $(document).on('hidden.bs.modal', '.modal', function() {
     window.scrollTo(0, savedScrollPosition);
 });

And then this to your css because you'll already have the modal-open class being added anytime the modal pops:

body.modal-open {
     position: fixed;
     width: 100%;
}

Thanks for the help ybentz!! I would've responded to your comment, but I don't have the reputation to do so yet.

like image 42
Geoff Avatar answered Oct 31 '22 05:10

Geoff