mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(input): do not clear input if "Enter" key pressed (#20462)
fixes #20442
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user