fix(input): clear on edit from inside native input (#17115)

fixes #17055
This commit is contained in:
Paul Stelzer
2019-05-07 23:55:42 +02:00
committed by Brandy Carney
parent 9030dcc111
commit 85093d6352
2 changed files with 14 additions and 0 deletions

View File

@ -314,6 +314,15 @@ export class Input implements ComponentInterface {
}
this.value = '';
/**
* This is needed for clearOnEdit
* Otherwise the value will not be cleared
* if user is inside the input
*/
if (this.nativeInput) {
this.nativeInput.value = '';
}
}
private focusChanged() {

View File

@ -118,6 +118,11 @@
<ion-input clear-input value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges"></ion-input>
</ion-item>
<ion-item>
<ion-label>Clear On Edit</ion-label>
<ion-input clear-on-edit value="reallylonglonglonginputtoseetheedgesreallylonglonglonginputtoseetheedges"></ion-input>
</ion-item>
<ion-item style="max-width: 250px">
<ion-input value="Narrow input"></ion-input>
<ion-label text-right>Left</ion-label>