Skip to content

bug: clicking within ion-input on the label triggers (click) twice #30165

Open
@ben-kn-app

Description

@ben-kn-app

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When you click on an ion-input with attribute (click)="function", this function is called twice when you click on the label within that ion-input. When you click on the value it is called once (as it should).

Expected Behavior

That the function would only be called once when you click on the label within the ion-input

Steps to Reproduce

Stackblitz

  1. Recent ionic & angular
  2. Example:
<ion-list>
  <ion-item>
    <ion-input label="Input with value" value="121 S Pinckney St #300" (click)="clicked()"></ion-input>
  </ion-item>

  <ion-item>
    <ion-input labelPlacement="floating" label="Input with value" value="121 S Pinckney St #300" (click)="clicked()"></ion-input>
  </ion-item>
</ion-list>
  1. Clicking on the label within the ion-input calls the function clicked() twice.

Code Reproduction URL

https://stackblitz.com/edit/ubs56gug?file=src%2Fapp%2Fexample.component.html

Ionic Info

Its ionic from the current stackblitz config used in the docs, from package.json:

"@angular/animations": "^19.0.0",
    "@angular/common": "^19.0.0",
    "@angular/compiler": "^19.0.0",
    "@angular/core": "^19.0.0",
    "@angular/forms": "^19.0.0",
    "@angular/platform-browser": "^19.0.0",
    "@angular/platform-browser-dynamic": "^19.0.0",
    "@angular/router": "^19.0.0",
    "@ionic/angular": "^8.0.0",
    "@ionic/core": "^8.0.0",
    "ionicons": "7.4.0",
    "rxjs": "^7.8.1",
    "tslib": "^2.5.0",
    "zone.js": "~0.15.0"

Additional Information

Adding event.preventDefault(); can be used as a dirty fix untill this issue gets resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions