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

bug: scroll top lost when typing in covered input field

Open m4b opened this issue 11 years ago • 5 comments

Type: bug

Platform: all

## Issue

When typing, or adding text to an ionic input field, when the input field is either:

  1. covered by the keyboard
  2. 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: good

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

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

  1. ionic start badscroll blank

  2. 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 the index.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>
    
  3. Touch/click on an input field

  4. 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

  5. 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.

m4b avatar Apr 21 '15 20:04 m4b

I can duplicate this in iOS, Ionic version 1.3.11.

ascendedmasta avatar Apr 22 '15 14:04 ascendedmasta

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.

ascendedmasta avatar Apr 30 '15 18:04 ascendedmasta

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.

Ionitron avatar Jul 29 '15 21:07 Ionitron

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).

ulesta avatar Jan 03 '17 15:01 ulesta

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 05 '18 10:09 ionitron-bot[bot]