Skip to content

Commit

Permalink
fix(input): do not clear input if "Enter" key pressed (#20462)
Browse files Browse the repository at this point in the history
fixes #20442
  • Loading branch information
liamdebeasi committed Feb 14, 2020
1 parent abf594a commit 89bf08b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/components/input/input.tsx
Expand Up @@ -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();
}
Expand Down

0 comments on commit 89bf08b

Please sign in to comment.