From 29bb4fcb05521ef42c543374b80fc149c056c714 Mon Sep 17 00:00:00 2001 From: konnectappdev <47423861+konnectappdev@users.noreply.github.com> Date: Tue, 16 Apr 2019 16:01:56 +0200 Subject: [PATCH] fix(input): prevent input from losing focus when tapping clear button (#18004) fixes #18002 --- core/src/components/input/input.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/components/input/input.tsx b/core/src/components/input/input.tsx index b8a332357d..dd7f306888 100644 --- a/core/src/components/input/input.tsx +++ b/core/src/components/input/input.tsx @@ -307,7 +307,12 @@ export class Input implements ComponentInterface { } } - private clearTextInput = () => { + private clearTextInput = (ev?: Event) => { + if (this.clearInput && !this.readonly && !this.disabled && ev) { + ev.preventDefault(); + ev.stopPropagation(); + } + this.value = ''; }