CngxAccordionPanel
projects/common/interactive/accordion/accordion-panel.directive.ts
Import#
import { CngxAccordionPanel } from '@cngx/common/interactive'
Description#
Accordion header. Put cngxAccordionPanel on the header <button>; the
directive mirrors aria-expanded from the coordinator, points
aria-controls at the region, and toggles the panel on click. It registers
a header handle with the coordinator on init (and deregisters on destroy),
binds its own roving tabindex, and routes keydown through the
coordinator's keyboard-nav factory - so arrow/Home/End navigation works even
when a skin renders the header inside its own component view (registration is
immune to the contentChildren view boundary).
Expansion state is never owned here: aria-expanded is a computed() over
the coordinator's open-set, so single-open arbitration is pure derivation,
not sibling syncing (Pillar 1). Use a native <button> so Enter / Space
activate it through the browser's own click synthesis.
Metadata#
Host#
Relationships
Index#
Methods
Inputs#
Disabled header: skipped by roving, reports tabindex="-1" +
aria-disabled="true", and its click never flips the panel open. The
visually-hidden aria-describedby reason element is a skin concern owned
by the organism, not this brain directive.
falseMethods#
HostBindings#
| Binding | Expression |
|---|---|
[attr.aria-expanded] | expanded() |
[attr.aria-controls] | controls() ?? null |
[attr.aria-disabled] | disabled() || null |
[attr.tabindex] | tabindex() |
HostListeners#
| Event | Handler |
|---|---|
(click) | click() |
(keydown) | keydown() |