fix(input): do not clear input if "Enter" key pressed (#20462)

fixes #20442
This commit is contained in:
Liam DeBeasi
2020-02-14 09:27:05 -05:00
committed by GitHub
parent abf594aa61
commit 89bf08b627

View File

@ -302,10 +302,11 @@ export class Input implements ComponentInterface {
this.ionFocus.emit();
}
private onKeydown = () => {
private onKeydown = (ev: KeyboardEvent) => {
if (this.shouldClearOnEdit()) {
// Did the input value change after it was blurred and edited?
if (this.didBlurAfterEdit && this.hasValue()) {
// Do not clear if user is hitting Enter to submit form
if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {
// Clear the input
this.clearTextInput();
}