feat: ion-accordion - allow a heading element around the header item (WAI-ARIA accordion pattern)

Aperta
#31,621 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
angular, html, typescript

Direzione di ricerca

Start by reading the ion-accordion header slot handling and ion-item role behavior; the issue provides a reproduction in src/app/repros/accordion.page.ts and identifies Ionic 8.8.5. Check how the header item becomes the keyboard toggle and how heading semantics could wrap that button. Done means the accessibility tree exposes a heading at the requested level containing an operable accordion toggle.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: feature request
Prerequisites
Describe the Feature Request

Allow the header of an ion-accordion to be exposed as a heading that contains the toggle
button, as in the WAI-ARIA accordion pattern: <h3><button aria-expanded>...</button></h3>.
Today there is no way to get this structure: the header ion-item only becomes the focusable
toggle when it is the direct child in the header slot, and it overrides any role set on it.

Describe the Use Case

Screen reader users navigate long pages by headings (VoiceOver rotor "Headings", TalkBack
heading navigation, NVDA/JAWS H key). In our app each Beleg (receipt) of an application is an
accordion; its title should be a level-3 heading so users can jump between them. An accessibility
audit (BITV/WCAG 1.3.1 Info and Relationships) flagged the missing headings.

What we tried (Ionic 8.8.5):

  • <h3 slot="header"><ion-item>...</ion-item></h3> - the h3 is slotted, but the ion-item
    inside is not turned into the toggle: no button (inner element stays a div), no
    ion-focusable class, no tabindex, so it cannot be reached or activated with the keyboard.
    A mouse click still toggles.
  • <ion-item slot="header" role="heading" aria-level="3"> - ion-item overrides the host role
    (inList ? 'listitem' : null); aria-level stays, role is gone.
  • A heading inside the item's label works, but inverts the pattern (button contains heading):
    VoiceOver's heading rotor does not reach it.
Describe Preferred Solution

A property on the accordion (e.g. headingLevel="3", or aria-level on the header item) that renders/exposes a heading wrapping the toggle button, so the accessibility tree becomes heading (level 3) > button (expanded/collapsed).

Describe Alternatives

Accept a heading element (h1-h6 or role="heading") in the header slot as a wrapper and still make the ion-item inside it the focusable toggle button.

Related Code

Reproduction (Angular, Ionic 8.8.5), page /repro/accordion "3 ion-accordion heading":
tab through the page (variant A gets no tab stop), then press "Inspect roles" (A focusable=false inner=<div>, B role=null aria-level=3).

Additional Information

No response

Lingua principale
TypeScript
Stelle
52.8k
Fork
13.3k
Merge medio
3g 1h
PR unite (30g)
86

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ionic-team/ionic-framework

Tutte le issue di ionic-team/ionic-framework

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.