Skip to content

ion-input and ion-textarea have incomplete maxlength logic #12647

@ryanhalley

Description

@ryanhalley

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.7.0

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

Set maxlength. Type into field, and see that maxlength is ignored. Leave field. Text is truncated to maxlength.

Expected behavior:
Set maxlength. Type into field and when you reach maxlength, every character after that is ignored.

Steps to reproduce:
Both debug via 'ionic cordova run android -cl', and Android (at least) release builds do not work as expected.

Related code:
Create a fresh ionic project using the 'blank' template. Change home.html as below:

<ion-header>
    <ion-navbar>
        <ion-title>MaxLength Tests</ion-title>
    </ion-navbar>
</ion-header>
<ion-content>
    <form> 
        <ion-list>
            <ion-item>
                <ion-label stacked>First Name</ion-label>
                <ion-input type="text" maxlength="5" ></ion-input>
            </ion-item>
            <ion-item>
                <ion-label stacked>Comment</ion-label>
                <ion-textarea maxlength="5" rows="4">
                </ion-textarea>
            </ion-item>
        </ion-list>
    </form>
</ion-content>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions