averyrousseau · GitHub

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

If you have an ion-accordion with readonly="true", tab to it, and press Enter, the accordion will open. This does not occur if readonly is set on the parent ion-accordion-group.

Expected Behavior

Readonly accordions should not be interactable, even with keyboard controls.

Steps to Reproduce

  1. Navigate to https://ionicframework.com/docs/api/accordion#individual-accordion-1
  2. Use the Tab key to focus the second accordion
  3. Press Enter; the accordion will open

Code Reproduction URL

https://ionicframework.com/docs/api/accordion#individual-accordion-1

Ionic Info

N/A (reproducible from v7 docs)

Additional Information

ion-accordion-group doesn't exhibit this behavior because of this piece:

if (readonly || disabled) {
return;
}

Fixing this in ion-accordion should hopefully be as simple as returning early if readonly is set here:

private toggleExpanded() {

Read the original on github.com ↗