bug: scroll top lost when typing in covered input field
Type: bug
Platform: all
## IssueWhen typing, or adding text to an ionic input field, when the input field is either:
- covered by the keyboard
- not visible inside of the scroll view (i.e., user scrolled away, typed before scrollTo method reached input field)
this results in the loss of the scroll top, meaning you cannot scroll back to the top, as the scroll view will not scroll all the way to the top, and the top will appear "cut off".
E.g.:
Before typing in covered input field:

After typing in covered input field, this is as high as it will go:

I can reproduce this issue in:
- all major browsers, firefox, chrome, and safari
- blackberry
- iOS (however, when inputting text it seems to scroll to the input field and thus prevents this issue, although typing fast after clicking on the input field does reproduce the issue, since presumably the input field is still covered at text entry time, as scrollTo hasn't finished yet)
- Issue #3263 reports similar problem for android, see the video they supplied at timemark 1:05, you will notice as they type in the input field, it hasn't finished scrolling to the input field (and hence is covered, which messes up the scroll top)
Steps to reproduce
Ionic version 1.3.19
-
ionic start badscroll blank -
add the following code, or something like it (the idea is to be able to scroll over input fields and then type when they're not in view, so you'll need lots of buttons or
<br>if doing this in a browser, mobile devices obviously not so much) to<ion-content>in theindex.html:<div class="card"> <div class="item item-text-wrap"> I'm the top of this, you have to be able to see me, and it better not be cut off at all </div> </div> <button class="button button-block button-assertive"> Block Button </button> <button class="button button-block button-royal"> Block Button </button> <button class="button button-block button-energetic"> Block Button </button> <button class="button button-block button-positive"> Block Button </button> <button class="button button-block button-assertive"> Block Button </button> <button class="button button-block button-energetic"> Block Button </button> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <div class="card"> <div class="item item-text-wrap"> Below is where the issue is </div> </div> <label class="item item-input"> <input type="text" placeholder="Type in me while the keyboard/scroll view is over me, and you're going to have a bad time"> </label> <label class="item item-input"> <input type="text" placeholder="Type in me while the keyboard/scroll view is over me, and you're going to have a bad time"> </label> <label class="item item-input"> <input type="text" placeholder="Type in me while the keyboard/scroll view is over me, and you're going to have a bad time"> </label> -
Touch/click on an input field
-
Maneuver the scroll viewport above the input field so that the input field is no longer visible, while not clicking out so as to lose focus --- ideally scroll to the top of the app
-
Type, (if in iOS, blackberry, or android, dismiss the keyboard) and observe the scroll top is now lost (at least on firefox, blackberry, etc., see above).
Note
I've noticed that the higher you scroll away from the input field, and the larger the scroll view (i.e., less screen size), the more it cuts off the top of the scroll top, so it isn't a constant value.
I can duplicate this in iOS, Ionic version 1.3.11.
Can duplicate in 1.3.14 and 1.3.19 on various iOS devices
Is anyone else having this issue? It basically makes forms useless within the Ionic Framework.
Greetings @m4b!
I've closed this issue because my sensors indicated it was old and inactive, and may have already been fixed in recent versions of Ionic. However, if you are still experiencing this issue, please feel free to reopen this issue by creating a new one, and include any examples and other necessary information, so that we can look into it further.
Thank you for allowing me to assist you.
I was able to reproduced this on Ionic 1.3.2, iOS 9.3, iOS 10.0.1, Android 7.1.1. Issue still persists. Happens when the focused input field is below the visible scroll area and is changed (i.e. via keyboard character press).
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.