Private
$modulePrivate
$sectionsPrivate
$showPrivate
$showPrivate
$showPrivate
configPrivate
controlsPrivate
downPrivate
i18nPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
sectionPrivate
showPrivate
showPrivate
upStatic
defaultsAccordion default config
Static
moduleName for the component used when initialising using data-module attributes.
Static
schemaAccordion config schema
Private
arePrivate
constructPrivate
getPrivate
Create an element to improve semantics of the section button with punctuation
Adding punctuation to the button can also improve its general semantics by dividing its contents into thematic chunks. See https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442
DOM element
Get the identifier for a section
We need a unique way of identifying each content in the Accordion.
Since an #id
should be unique and an id
is required for aria-
attributes id
can be safely used.
Section element
Identifier for section
Private
initPrivate
initPrivate
isPrivate
onPrivate
onPrivate
onPrivate
setPrivate
setPrivate
storePrivate
update
Accordion component
This allows a collection of sections to be collapsed by default, showing only their headers. Sections can be expanded or collapsed individually by clicking their headers. A "Show all sections" button is also added to the top of the accordion, which switches to "Hide all sections" when all the sections are expanded.
The state of each section is saved to the DOM via the
aria-expanded
attribute, which also provides accessibility.Preserve