Skip to content

feat(Accordion): expandable panel list - #394

Open
ebellamy-bh wants to merge 2 commits into
mainfrom
feat/accordion
Open

feat(Accordion): expandable panel list#394
ebellamy-bh wants to merge 2 commits into
mainfrom
feat/accordion

Conversation

@ebellamy-bh

Copy link
Copy Markdown

Adds the generic expandable-panel primitive the library was missing — ServiceAccordion is domain-specific, and consumers (bluehive-marketing's FAQ lists among them) have been hand-rolling this pattern.

What it does

  • single / multiple open modes, uncontrolled (defaultOpenIds) or controlled (openIds/onOpenChange), with collapsible for single mode
  • Animates to natural height using the CSS grid-rows trick (0fr → 1fr) — no max-height clipping of long answers (the bug lurking in the hand-rolled versions)
  • Real a11y wiring: triggers are buttons inside configurable headings (headingLevel), with aria-expanded/aria-controls and labelled panel regions; per-item disabled
  • Two variants: separated cards with gaps, or a joined bordered list with dividers

Screenshots

Light Dark
Accordion light Accordion dark

Provenance

Generalizes bluehive-marketing/src/components/ui/FAQAccordion.tsx (FAQ lists on the marketing site) into a data-driven primitive with modes, variants, and controlled state.

Testing

  • 7 unit tests (aria wiring, single closes previous, non-collapsible floor, multiple independence, controlled state, disabled items)
  • 4 stories: FAQ default, joined variant, multiple mode, controlled
  • typecheck / lint / format / rtl:scan clean; combined batch suite 622/622

Generalizes bluehive-marketing's FAQAccordion into a design-system
primitive: single/multiple modes, controlled or uncontrolled open
state, separated-card and joined-list variants, per-item disable, and
heading-wrapped triggers with aria-expanded/aria-controls. Panels
animate to natural height via CSS grid rows instead of a max-height
clip.
Copilot AI lite review requested due to automatic review settings August 23, 2026 03:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new generic Accordion component to the UI library to replace domain-specific and hand-rolled “expandable panel list” implementations, with Storybook examples and unit coverage.

Changes:

  • Introduces src/components/Accordion/Accordion.tsx with single/multiple open modes, controlled/uncontrolled state, and two visual variants (separated / joined).
  • Adds Storybook stories demonstrating common use cases (FAQ, joined variant, multiple mode, controlled state).
  • Wires the component into library exports and build entry points (src/index.ts, tsup.config.ts), plus adds unit tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsup.config.ts Adds Accordion as an individual component entry for tree-shaking.
src/index.ts Re-exports Accordion from the package root.
src/components/Accordion/index.ts Adds barrel export for Accordion and its public types.
src/components/Accordion/Accordion.tsx Implements the Accordion component, variants, state management, and ARIA wiring.
src/components/Accordion/Accordion.test.tsx Adds unit tests for open/close behavior, controlled state, aria wiring, and disabled items.
src/components/Accordion/Accordion.stories.tsx Adds Storybook stories covering default, joined, multiple, and controlled scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/components/Accordion/Accordion.tsx
Comment thread src/components/Accordion/Accordion.tsx
Comment thread src/components/Accordion/Accordion.tsx
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 23, 2026

Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4859c3b
Status: ✅  Deploy successful!
Preview URL: https://1135cac8.ui-6d0.pages.dev
Branch Preview URL: https://feat-accordion.ui-6d0.pages.dev

View logs

…normalization, safelist

- Collapsed panels get aria-hidden + inert (CollapsiblePill/ServiceAccordion
  pattern) so visually-clipped content is unreachable by AT and Tab
- type=single normalizes open state to at most one id even when
  defaultOpenIds/openIds hand it several
- grid-rows-[0fr]/[1fr] + transition-[grid-template-rows] added to both
  Tailwind 3 safelist twins
Copilot AI review requested due to automatic review settings August 23, 2026 04:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

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