Skip to content

feat(accordion-group): add headingLevel property - #31852

Open
brandyscarney wants to merge 4 commits into
feature-9.1from
FW-7908
Open

brandyscarney wants to merge 4 commits into
feature-9.1from
FW-7908

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Issue number: resolves #31621


What is the current behavior?

Accordion headers can't be exposed as headings, so screen reader users can't jump between accordions with heading navigation (VoiceOver rotor, NVDA/JAWS H key). The WAI-ARIA accordion pattern wraps each header button in a heading, but there's no way to get that structure today. Wrapping the ion-item in an h3 stops it from becoming the toggle button, and ion-item overrides any role set on it.

What is the new behavior?

  • Added a headingLevel property to ion-accordion-group (heading-level attribute, 1 to 6). When it's set, each accordion in the group exposes its header as a heading with that level. When the header is an ion-item, the heading contains its toggle button: heading (level 3) > button (expanded/collapsed). It's opt-in, so groups without it don't change.
  • The level is set on the group because accordions in a group are sibling sections, so they share one level. A nested group sets its own headingLevel and doesn't inherit one.
  • Removing the attribute or binding null removes the heading. Values that aren't a whole number from 1 to 6 don't add a heading and log a warning, since a heading without a valid aria-level would be announced as level 2.
  • Accordions re-render when the group's level changes and whenever they're connected, so an accordion added after load, moved to another group, or removed and added back picks up the current level.
  • There's no visual change. Only the accessibility tree changes, so no screenshots were updated.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Docs PR: ionic-team/ionic-docs#4919

To try it, open the basic test page, run this in the console, then inspect an accordion header in the Accessibility pane of the browser dev tools:

document.querySelectorAll('ion-accordion-group').forEach((g) => (g.headingLevel = 3));

Add a headingLevel property to ion-accordion-group so each accordion
header in the group is exposed to assistive technology as a heading that
contains the toggle button, following the WAI-ARIA accordion pattern.
Previously there was no way to get this structure, so screen reader
users could not move between accordions using heading navigation.

The level applies to every accordion in the group. Nested groups set
their own level and do not inherit one. Values that are not a whole
number from 1 to 6 do not expose a heading and log a warning.

Closes #31621
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Dec 1, 2026 6:25pm UTC

Request Review

@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package labels Dec 1, 2026
An accordion that was removed from its group, and then added back to the
same group after the group's heading level changed, kept the old level.
The accordion now re-renders every time it connects, so its header always
uses the current heading level of its group.

Also annotates the heading level test with the issue it covers.
@brandyscarney
brandyscarney marked this pull request as ready for review December 1, 2026 18:54
@brandyscarney
brandyscarney requested a review from a team as a code owner December 1, 2026 18:54
@brandyscarney
brandyscarney requested a review from ShaneK December 1, 2026 18:54

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Awesome work!

This branch was successfully deployed

1 active deployment
Preview — 6594f562 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants