Skip to content

bug: checkbox inside an accordion content causes the accordion onIonChange event to fire #27724

@corysmc

Description

@corysmc

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

If I have a checkbox inside of an ion-accordion element, when the checkbox is checked the accordion also fires a change event - which in my case - closes the accordion.

Expected Behavior

Events inside the accordion content should not cause the accordion change event to fire.

Steps to Reproduce

  1. Add an ion-checkbox to the inside of the content of an ion-accordion
  2. Add an event listener to the accordion-group
  3. Check the box - notice the accordion group event fires

Workaround - add event.stopPropagation to the checkbox event listener

Code Reproduction URL

https://stackblitz.com/edit/g4jdvt?file=src%2Fmain.tsx

Ionic Info

N/A

Additional Information

#26771

The solution to this bug is for a checkbox inside the accordion header - so the fix makes sense. However, I would not expect an item inside the content to toggle the accordion closed.

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