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

Textarea not scrollable

Open ashconnell opened this issue 12 years ago • 46 comments

Tested on a bunch of android devices (Nexus 5: 4.4, Galaxy S4: 4.3, Galaxy S3) and iOS devices (iPhone4S: iOS6, iPhone5: iOS7.1) and the textarea is not scrollable when the content is larger than the textarea size.

Also of note, the keyboard-open class is not added to body element like inputs are.

Version: Beta3

I'm using basic recommended html

<div class="list">
    <div class="item item-input">
        <textarea></textarea>
    </div>
</div>

For others who also might need a quick fix, I am going to throw in an autogrow script.

ashconnell avatar May 05 '14 23:05 ashconnell

I tried a bunch of autogrow scripts, including building one of my own. None of which play nicely with ionic and the way it handles taps and keyboard etc.

ashconnell avatar May 06 '14 01:05 ashconnell

I'm running into the same issue right now. One of my views is a big form and scrolling is currently impossible. This is happening on v1.0.0-beta.3-nightly-1978 and Android 4.4.2

mkuklis avatar May 07 '14 19:05 mkuklis

Taking a look at this right now

tlancina avatar May 07 '14 19:05 tlancina

wow that was fast response. Thank you @tlancina I'm working on project which has to be finalized by May 15th and this one worries me a bit. So thank you for looking into it.

mkuklis avatar May 07 '14 19:05 mkuklis

Just to add here couple more details about it. If I place my finger on the Textarea and move my finger very slowly the scrolling works as expected but if I move it quickly in order to scroll to the bottom of the screen then scrolling fails (sorry if this is not a good description). I've noticed the same behavior with other form input fields.

mkuklis avatar May 07 '14 19:05 mkuklis

So we know why it's happening, just talking with @adamdbradley on addressing this specific scenario, stay tuned!

tlancina avatar May 07 '14 19:05 tlancina

great thank you @tlancina

mkuklis avatar May 07 '14 19:05 mkuklis

So it looks to me like it's actually a css issue, @mkuklis if you need a quick fix try removing overflow: hidden from .item-input in your css for now.

tlancina avatar May 07 '14 21:05 tlancina

@tlancina thanks will give it a try.

mkuklis avatar May 07 '14 22:05 mkuklis

Thanks @tlancina This fixed it for iOS only. Android is still undraggable

ashconnell avatar May 08 '14 01:05 ashconnell

Okay this isn't the fix, but a step closer to one. I managed to fix it by making a textarea directive to stop touchstart touchmove touchend events bubbling up to ionic's document tap handler. This allows you to scroll the textarea BUT doesn't allow you to scroll the ion-content (obviously, since events are caught before it bubbles up that far)

Here is my test code:

app.directive('textarea', function(){
    return {
        restrict: 'E',
        scope: {
            'noIonic': '='
        },
        link: function(scope, element, attr){
            if(scope.noIonic){
                element.bind('touchend  touchmove touchstart', function(e){
                    e.stopPropagation();
                });    
            } 
        }
    }
});

This might be good enough for some people who need a fix immediately

ashconnell avatar May 08 '14 01:05 ashconnell

Another fix that might work better is to disable these events when focused, and re-enable them on blur. This would mean scrolling the textarea will work when you have focus/keyboard-up, and scroll the ion-content when it is not.

ashconnell avatar May 08 '14 01:05 ashconnell

As @phoey noted in #1600, this can create a problem for very large text areas.

perrygovier avatar Jun 10 '14 16:06 perrygovier

Gonna reopen this as a regression

perrygovier avatar Jun 10 '14 17:06 perrygovier

Any update to this @perrygovier ?

joemcelroy avatar Jun 16 '14 11:06 joemcelroy

Has that commit made it into master?

toby-m avatar Jul 25 '14 06:07 toby-m

It has, Closing it as tim's commit says this closed the issue. Let me know if you're still seeing it.

perrygovier avatar Sep 08 '14 21:09 perrygovier

My text area is still not scrollable when keyboard is open. Also when I press in the text field the cursor always returns to the top or bottom impossible to move the cursor to a desired spot.

I tried updating to Ionic, v1.0.0-beta.13. I have a very large text area with in a slide though not sure if that would be a problem:

<ion-slide class="post-slide">
       <journalheader entry="entry"></journalheader>
       <ion-content padding="true" class="has-header">
              <form>
                     <textarea ng-model="post.content" ng-keyup="save()"> Content </textarea><br/>
             </form>
       </ion-content>
       <journalfooter class="hide-on-keyboard-open"></journalfooter>           
</ion-slide>

jpsmith1981 avatar Oct 09 '14 21:10 jpsmith1981

Hy,

Any update to this?? I have the same issue with Ionic beta 13.

Thanks

edolix avatar Nov 21 '14 16:11 edolix

Hi guys,

I've got the same issue - when my textarea is focused, I can't scroll the whole page by touching inside the textarea. I saw the issue was resolved in https://github.com/driftyco/ionic/issues/2374 but I can't seem to resolve it by using the directive there.

I've tried to update ionic bundle to beta 14 but the issue is still there.

I've been testing on HTC One.

Any fix?

Thanks a lot.

YZSheng avatar Dec 21 '14 07:12 YZSheng