Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsible: --radix-collapsible-content-height CSS variable missing when equal to 0 #3037

Open
fuma-nama opened this issue Jul 27, 2024 · 0 comments

Comments

@fuma-nama
Copy link

fuma-nama commented Jul 27, 2024

Bug report

Current Behavior

When the Collapsible Content height is zero (empty content), --radix-collapsible-content-height isn't added to CSS variables.
This is problematic because in CSS, variables are inherited from parents.

In a nested structure of collapsible, this causes animation that depends on --radix-collapsible-content-height to use the value from parent, which is an incorrect value.

Directory.animation.bug.mov

For example, math item is a collapsible with zero height, it inherits the variable --radix-collapsible-content-height from parent, because it is missing on the math item itself.

Expected behavior

--radix-collapsible-content-height should be defined on the content node (--radix-collapsible-content-height: 0 in element styles)

Reproducible example

https://codesandbox.io/p/sandbox/lucid-rain-wr283c

The nested item with empty content doesn't have the variable defined.

Suggested solution

N/A

Additional context

N/A

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-collapsible 1.1.0
React n/a 18.3.0
Browser chrome latest
Assistive tech
Node n/a 18
npm/yarn pnpm 9.5
Operating System MacOS 14.5
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

No branches or pull requests

1 participant