From 20a75994f9d01ea3c1a370962b5b9bb20f6ce896 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Fri, 7 Sep 2018 17:13:42 +0200 Subject: [PATCH] fix(searchbar): ionCancel event fixes #15476 --- core/src/components/searchbar/searchbar.tsx | 12 +++++++++--- .../components/searchbar/test/basic/index.html | 16 ++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/core/src/components/searchbar/searchbar.tsx b/core/src/components/searchbar/searchbar.tsx index 43fabbe02c..461f797b18 100644 --- a/core/src/components/searchbar/searchbar.tsx +++ b/core/src/components/searchbar/searchbar.tsx @@ -184,9 +184,15 @@ export class Searchbar { * the clearInput function doesn't want the input to blur * then calls the custom cancel function if the user passed one in. */ - private cancelSearchbar() { + private cancelSearchbar(ev?: Event) { + if (ev) { + ev.preventDefault(); + ev.stopPropagation(); + } this.ionCancel.emit(); this.clearInput(); + + this.nativeInput.blur(); } /** @@ -332,7 +338,8 @@ export class Searchbar {