mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(searchbar): only trigger the input event on clear if there is a value
fixes #6382
This commit is contained in:
@@ -298,9 +298,11 @@ export class Searchbar extends Ion {
|
||||
clearInput() {
|
||||
this.ionClear.emit(this);
|
||||
|
||||
this.value = '';
|
||||
this.onChange(this.value);
|
||||
this.ionInput.emit(this);
|
||||
if (isPresent(this.value) && this.value !== '') {
|
||||
this.value = '';
|
||||
this.onChange(this.value);
|
||||
this.ionInput.emit(this);
|
||||
}
|
||||
|
||||
this.blurInput = false;
|
||||
}
|
||||
|
||||
@@ -12,23 +12,23 @@ class E2EApp {
|
||||
defaultCancel: string = '';
|
||||
|
||||
onClearSearchbar(searchbar) {
|
||||
console.log("Clicked clear input on", searchbar.value);
|
||||
console.log("ionClear", searchbar.value);
|
||||
}
|
||||
|
||||
onCancelSearchbar(searchbar) {
|
||||
console.log("Clicked cancel button with", searchbar.value);
|
||||
console.log("ionCancel", searchbar.value);
|
||||
}
|
||||
|
||||
triggerInput(searchbar) {
|
||||
console.log("Triggered input", searchbar.value);
|
||||
console.log("ionInput", searchbar.value);
|
||||
}
|
||||
|
||||
inputBlurred(searchbar) {
|
||||
console.log("Blurred input", searchbar.value);
|
||||
console.log("ionBlur", searchbar.value);
|
||||
}
|
||||
|
||||
inputFocused(searchbar) {
|
||||
console.log("Focused input", searchbar.value);
|
||||
console.log("ionFocus", searchbar.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user