Keyboard
| Key | Does |
|---|---|
| Tab | Moves to the next header, skipping the panels' contents |
| Enter / Space | Opens or closes the focused section |
| ↑ / ↓ | Moves between headers, wrapping |
| Home / End | Jumps to the first or last header |
Each header is a <button> inside a role="heading" element. The heading is what lets a screen reader list the sections; the button is what operates them.
Set headingLevel to fit the accordion into the page's outline. It defaults to 3.
<NbAccordion :heading-level="2">
<NbAccordionItem title="Under an h1" />
</NbAccordion>The heading is a role="heading" div rather than an <h3> on purpose. A real <h3> inherits any some-container h3 { margin } the host page has, and an element selector inside a class outranks a component's own scoped rule, so the component cannot defend against it. That is not theoretical: it was adding 20px above every title in these very docs.