Repository navigation
feat(accordion-group): add headingLevel property - #31852
Open
brandyscarney wants to merge 4 commits into
Open
brandyscarney wants to merge 4 commits into
brandyscarney wants to merge 4 commits into
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
ShaneK
approved these changes
Dec 1, 2026
ShaneK
left a comment
Member
There was a problem hiding this comment.
Looks great to me! Awesome work!
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Hkey). The WAI-ARIA accordion pattern wraps each header button in a heading, but there's no way to get that structure today. Wrapping theion-itemin anh3stops it from becoming the toggle button, andion-itemoverrides anyroleset on it.What is the new behavior?
headingLevelproperty toion-accordion-group(heading-levelattribute,1to6). When it's set, each accordion in the group exposes its header as a heading with that level. When the header is anion-item, the heading contains its toggle button:heading (level 3) > button (expanded/collapsed). It's opt-in, so groups without it don't change.headingLeveland doesn't inherit one.nullremoves the heading. Values that aren't a whole number from1to6don't add a heading and log a warning, since a heading without a validaria-levelwould be announced as level 2.Does this introduce a breaking change?
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: