Skip to content

[bug]: AccordionContent inner div's fixed height clips dynamic content (radix-luma) #10336

@phalla-doll

Description

@phalla-doll

Description

In the radix-luma style, AccordionContent applies h-(--radix-accordion-content-height) on the inner <div> wrapper. This locks the content height to whatever Radix measured when the accordion first opened, which clips any content that changes size dynamically after opening.

Reproduction

  1. Create an accordion with a list that can expand (e.g., "Show all items" button that reveals more entries)
  2. Open the accordion
  3. Click the button to expand the list
  4. The newly added items are clipped/cut off — you cannot scroll to see them

Root Cause

In accordion.tsx, the AccordionContent component:

<AccordionPrimitive.Content
  className="overflow-hidden px-4 text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
>
  <div className={cn(
    "h-(--radix-accordion-content-height) pt-0 pb-4 ...",  // ← this
    className
  )}>
    {children}
  </div>
</AccordionPrimitive.Content>

--radix-accordion-content-height is a CSS variable set by Radix at open time for the animation. The outer AccordionPrimitive.Content already uses it correctly via animate-accordion-down/animate-accordion-up. Applying it as a fixed h-() on the inner div serves no purpose after the animation completes and prevents the content from growing.

Fix

Remove h-(--radix-accordion-content-height) from the inner div:

- "h-(--radix-accordion-content-height) pt-0 pb-4 [&_a]:underline ...",
+ "pt-0 pb-4 [&_a]:underline ...",

Affected Style

radix-luma (confirmed via npx shadcn@latest view @shadcn/accordion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions