Skip to content

✨ feat: add Collapse component - #730

Open
futjesus wants to merge 1 commit into
mainfrom
feat/collapse
Open

futjesus wants to merge 1 commit into
mainfrom
feat/collapse

Conversation

@futjesus

@futjesus futjesus commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Compute (Collapse), settings (AnimatedHeight) and kubernetes (ExpandableCard, InstalledAppsTab Card) each animate content height with motion, with three different takes on reduced motion, overflow clipping and aria-controls.

  • Collapse (new): animates height, opacity and collapsedMarginTop; duration drops to zero under prefers-reduced-motion; overflow is clipped only while animating so a Select or tooltip inside is never cut; onExitComplete after unmount.
  • keepMounted: keeps the region in the DOM while collapsed (hidden + aria-hidden) so a trigger's aria-controls always resolves, the pattern kubernetes documented.
  • Exported from the package root. motion is already a dependency (Modal).

Test plan

  • New tests: mount/unmount with onExitComplete, closed by default, keepMounted hidden + aria-hidden, axe (with MotionGlobalConfig.skipAnimations)
  • npx vitest run lib/components/Collapse, lint, types, prettier
  • Storybook: Collapse (toggle with two Selects inside)

Compute (Collapse), settings (AnimatedHeight) and kubernetes
(ExpandableCard, InstalledAppsTab Card) each animate content height with
motion, with three different takes on reduced motion, overflow and
`aria-controls`. Collapse animates height, opacity and a collapsed margin,
drops the duration to zero under `prefers-reduced-motion`, clips overflow
only while animating so dropdowns inside are never cut, and with
`keepMounted` keeps the region in the DOM (hidden and aria-hidden) so a
trigger's `aria-controls` always resolves.

This branch has not been deployed

No deployments
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