ionic1 app : keyboard scroll issue - the cursor displays in the wrong place

212 Views Asked by At

enter image description here

When I focus input box, the cursor displayed in the wrong place. It's built using Ionic 1.

Why?

Thank you

1

There are 1 best solutions below

0
BestMob On

I used this at first

<ion-content class="side-menu">

But someone reported that they couldn't see what they are typing in inputbox. Inputbox is hidden under the keyboard and the cursor displays in the wrong place.

Actually it worked will on Samsung Galaxy S3. But to fix that issue(not on Samsung Galaxy S3, even it worked well on my iPhone), I added this.

<ion-content class="side-menu" delegate-handle="mainScroll" overflow-scroll="false">

After add above code, there was issue on Samsung Galaxy too.

So I removed this code again. delegate-handle="mainScroll" overflow-scroll="false"

Could you please let me know how we can make sure it works on the other iPhone device too? maybe iPhone 8

enter image description here

<input type="text" id="places" ng-focus="scrollTo('places')" />

$scope.scrollTo = function (elementId) {
      $timeout(function() {
        var elem = document.getElementById(elementId);
        var yOffset = elem.offsetTop;
        var elementHeight = elem.offsetHeight;
        var scrollPoint = yOffset + elementHeight - 100;
        console.log(yOffset, scrollPoint);
        $ionicScrollDelegate.$getByHandle('mainScroll').scrollTo(0, scrollPoint, true);
        //$ionicScrollDelegate.scrollTo(0, scrollPoint, true);

        var quotePosition = $ionicPosition.position(angular.element(elem));
        console.log(quotePosition);
        //$ionicScrollDelegate.$getByHandle('mainScroll').scrollTo(0, quotePosition, true);
      }, 200);
    };

scrollTo is not working well.