ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
127 stars 85 forks source link

<ion-searchbar> (ionClear) is calling twice #163

Open ionitron-bot[bot] opened 5 years ago

ionitron-bot[bot] commented 5 years ago

Original issue by @Bloggerschmidt on 2017-01-11T14:13:22Z

Ionic version: (check one with "x") [ ] 1.x [x] 2.x

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

Clicking the clear button in <ion-searchbar> (the x at the end) (ionClear) is calling a function twice (for the event types 'mousedown' and 'click').

Expected behavior:

(ionClear) should call only once (for event type 'click' or (!) 'mousedown')

Steps to reproduce:

ionic start --v2 myApp blank

Related code:

home.html

<ion-header>
  <ion-navbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
<ion-searchbar 
    primary 
    [(ngModel)]="address" 
    (ionClear)="clearSearch($event)"
></ion-searchbar>
</ion-content>

home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})
export class HomePage {

    address = '';

    constructor(public navCtrl: NavController) {
    }

    clearSearch(e) {
        console.log('clearSearch', e);
    }

}

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.9.0 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v7.4.0
Xcode version: Xcode 8.2.1 Build version 8C1002
Sagarkhenat commented 5 years ago

Any updates on this the ionClear is calling two events mousedown and click resulting in keyboard appearing twice