Skip to content

docs(accordion): document headingLevel property for accessibility - #4919

Merged
brandyscarney merged 2 commits into
feature-9.1from
FW-7908
Dec 2, 2026
Merged

brandyscarney merged 2 commits into
feature-9.1from
FW-7908

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Adds a Heading Level section under Accessibility in the accordion docs for the new headingLevel property on ion-accordion-group from ionic-team/ionic-framework#31852. The section explains how setting the property exposes each accordion header as a heading so screen reader users can navigate between accordions, how to choose a level that fits the page's heading structure, and how nested accordion groups need their own headingLevel. It includes a note that the property is supported starting in v9.1.

Since the property has no visual effect, the section uses framework tabs with code samples (matching the accessibility examples on Alert and Action Sheet) rather than a playground.

Accordion heading level docs

@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-docs Ready Ready Preview Dec 1, 2026 6:21pm UTC

Request Review

@brandyscarney
brandyscarney marked this pull request as ready for review December 1, 2026 18:41
@brandyscarney
brandyscarney requested a review from a team as a code owner December 1, 2026 18:41
@brandyscarney
brandyscarney requested review from thetaPC and removed request for a team December 1, 2026 18:41

@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.

LGTM! Great work 🚀

@brandyscarney
brandyscarney merged commit 2d04fbc into feature-9.1 Dec 2, 2026
7 checks passed
@brandyscarney
brandyscarney deleted the FW-7908 branch December 2, 2026 14:01
brandyscarney added a commit to ionic-team/ionic-framework that referenced this pull request Dec 2, 2026
Issue number: resolves #31621

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

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?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- 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
- [X] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->

## Other information

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

To try it, open the [basic test
page](https://ionic-framework-git-fw-7908-ionic1.vercel.app/src/components/accordion/test/basic?ionic:mode=md),
run this in the console, then inspect an accordion header in the
Accessibility pane of the browser dev tools:

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

---------

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — 2a1b7ab2 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants