Skip to content

[FIR-295] Add the ff-accordion pattern composing ff-panel - #63

Merged
mfg1986 merged 5 commits into
developfrom
feature/FIR-295_panel-accordion
Jul 27, 2026
Merged

[FIR-295] Add the ff-accordion pattern composing ff-panel#63
mfg1986 merged 5 commits into
developfrom
feature/FIR-295_panel-accordion

Conversation

@mfg1986

@mfg1986 mfg1986 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Delivers the accordion visualization (FIR-295, FF-CAT-04) as a new pattern, ff-accordion, composing ff-panel + ff-icon — the primitive stays untouched, the composition-hierarchy rule holds (contract composes verified, ALL_CONTRACTS now 23 primitives + 7 patterns).

  • API mirrors the sibling patterns: sections: FfAccordionSection[] + [ffAccordionSection] template directive; controlled mode: single|multiple with expandedIds/expandedIdsChange (like ff-tab-bar's activeId).
  • Accessibility: header is a native button with aria-expanded/aria-controls; body is role=region + aria-labelledby and goes inert while collapsed; Arrow/Home/End keyboard skips disabled; toggle guarantees a ≥44px tap target.
  • Height animation is CSS-only (grid-template-rows 0fr/1fr, no JS measurement), dropped under prefers-reduced-motion.
  • New AccordionContract, catalog page at /patterns/accordion, and both packages' [Unreleased] changelogs updated.

Structural decision (pattern vs growing ff-panel) recorded in the implementation commit body.

How to verify

  • pnpm nx test design-system — 641/641 (13 new accordion specs: single/multiple semantics, disabled, keyboard, projection)
  • pnpm nx serve playground --port 4312 → /patterns/accordion
  • VR suite 15/15 with zero baseline diffs (parity page untouched)

Traceability

Board ticket without owning PASO: key in branch and commit subjects.

mfg1986 added 5 commits July 23, 2026 13:20
Defines the ff-accordion pattern contract (composes ff-panel and
ff-icon only): sections/mode/expandedIds API, the toggle-button +
role=region behavior clauses, and the roving-header keyboard model.
Wires it into ALL_CONTRACTS (23 primitives + 7 patterns) and updates
the structural inventory spec.
Adds FfAccordionComponent: stacked disclosure sections composing
ff-panel (header zone hosts the toggle button, body zone hosts the
region) and ff-icon (chevron). Single/multiple expansion is fully
controlled via expandedIds/expandedIdsChange, mirroring ff-tab-bar's
activeId contract. Section bodies are arbitrary templates matched by
id through the new [ffAccordionSection] structural directive, the
same idiom ff-data-table uses for its cell templates.

A ff-accordion + ff-accordion-item pair (child components registering
into a parent, like mat-accordion or ng-hub-ui-panels' hub-panel/
hub-panels) was considered and rejected: every existing pattern in
this library (ff-tab-bar, ff-data-table, ff-list, ff-menu-button) is a
single top-level component with metadata inputs and, where content is
arbitrary, matching structural template directives — never a
container/child component pair. A single ff-accordion composing
ff-panel keeps that convention, gives the contract package one
selector to track instead of two, and needs no DI wiring between a
container and its children.

Accessibility: each header is a native <button id> with aria-expanded
and aria-controls; each body is role="region" with aria-labelledby,
marked inert while collapsed so its content is unreachable by pointer,
keyboard and assistive technology until expanded. Keyboard: ArrowDown/
ArrowUp/Home/End rove focus across enabled headers (Enter/Space toggle
via native button semantics), reusing ff-tab-bar's roving-tabindex
querySelectorAll approach.

The collapse animates a CSS grid-template-rows track (0fr/1fr) rather
than measuring pixel heights in script, and the transition (plus the
chevron rotation) is dropped entirely under
prefers-reduced-motion: reduce, the same media query ff-skeleton uses
for its shimmer.

Exports FfAccordionComponent, FfAccordionSectionTemplateDirective and
the FfAccordionMode/FfAccordionSection/FfAccordionSectionTemplateContext
types from the package's public index.
New /patterns/accordion route demonstrating single mode (default,
expanding a section closes the previously open one), multiple mode
(sections expand independently) and a disabled section, following the
existing DemoSection idiom used by the tab-bar page. Registers the
route in app.routes.ts and the entry in PATTERN_COMPONENTS so the
shell sidebar and the patterns index pick it up automatically; updates
the patterns index page's "Three patterns" copy to "Four".
Adds Unreleased entries to design-system and design-system-contract
changelogs for the new ff-accordion pattern and its contract.
@mfg1986
mfg1986 merged commit 3fbc23f into develop Jul 27, 2026
5 checks passed
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.

1 participant