Skip to content

bug: conditional appearance of the content of an ion-item prevent click on right and left edge of the ion-item (with checkbox) #29763

Description

@JulienLecoq

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When putting a ion-checkbox inside of an ion-item, the click on the right and left edge of the ion-item only works at the beginning. Once I hide and show again the checkbox, the click on the right and left edge of the ion-item does not work anymore.

ion-item_click_bug.mov

Expected Behavior

The ion-item should be clickable after hiding/showing the checkbox.

Steps to Reproduce

  1. Paste the following code in a page:
  <ion-item>
    @if (showCheckbox()) {
      <ion-checkbox (ionChange)="stateChange()">Test checkbox</ion-checkbox>
    } @else {
    <ion-label>
      Test checkbox
    </ion-label>

    <ion-spinner
      slot="end"
      name="lines"
      class="item-spinner">
    </ion-spinner>
    }
  </ion-item>

  <ion-button (click)="toggleDisplay()">Toggle</ion-button>
  showCheckbox = signal(true)

  stateChange() {
    console.log('Checkbox state changed.')
  }

  toggleDisplay() {
    this.showCheckbox.set(!this.showCheckbox())
  }
  1. Try to click on the left or right edge of the ion-item after toggling the display of the checkbox once.
  2. The click should not work after toggling the display.

Code Reproduction URL

https://github.com/JulienLecoq/ion-item_click_bug_after_toggling_display/tree/main

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (/Users/julien_lecoq/.nvm/versions/node/v20.14.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 8.2.6
@angular-devkit/build-angular : 18.1.4
@angular-devkit/schematics : 18.1.4
@angular/cli : 18.1.4
@ionic/angular-toolkit : 11.0.1

Capacitor:

Capacitor CLI : 6.1.2
@capacitor/android : not installed
@capacitor/core : 6.1.2
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v20.14.0 (/Users/julien_lecoq/.nvm/versions/node/v20.14.0/bin/node)
npm : 10.7.0
OS : macOS Unknown

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions