feat(textarea): ionChange will only emit from user committed changes (#25953)

This commit is contained in:
Sean Perkins
2022-09-23 13:26:21 -04:00
committed by GitHub
parent a03c8afb3d
commit 68bae80a51
15 changed files with 280 additions and 33 deletions

View File

@@ -344,6 +344,7 @@ export class Input implements ComponentInterface {
*/
private emitValueChange() {
const { value } = this;
// Checks for both null and undefined values
const newValue = value == null ? value : value.toString();
this.ionChange.emit({ value: newValue });
}
@@ -368,7 +369,7 @@ export class Input implements ComponentInterface {
});
}
private onInput = (ev: Event) => {
private onInput = (ev: InputEvent | Event) => {
const input = ev.target as HTMLInputElement | null;
if (input) {
this.value = input.value || '';