chocolate cake
chocolate cake

Reputation: 2479

Click on input field triggers window resize on android

I have an input field in my cordova app. When I focus the input field by clicking on it, the window resize function is called on android. On iOS everything works fine. The resizing makes problems because I have a text that is rendered with epub.js and it goes back to the beginning of the current chapter when clicking on that text field.

How can I prevent the resizing?

I tried this, but the problem is still there: Click on input field triggers window resize

HTML:

<form id="realPageInputForm" ng-submit="goToRealPage(inputPage)">
     <input ng-model-options="{ getterSetter: true }"     
           id="realPageInput" 
           class="inputPage input-label" 
           type="number" 
           name="inputPage" 
           ng-model="inputPage" 
           placeholder="Enter page here">
</form>

Upvotes: 1

Views: 1625

Answers (1)

Juan Miguel S.
Juan Miguel S.

Reputation: 601

It happens beacuse when you click on that input, the keyboard appears and, in android, keyboard make your view smaller (screen size is shared between your app and the keyboard); and when keyboard hides the webview recover again their original size. You can check on other answers to questions similar to yours, like PhoneGap: Is there a way to stop the keyboard from resizing the view?.

Upvotes: 2

Related Questions