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

Fixed "Collapsible: --radix-collapsible-content-height CSS variable m… #3270

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neo-schobert
Copy link

Description
This pull request fixes a bug where the --radix-collapsible-content-height CSS variable is not set when the Collapsible content's height equals zero. This issue caused incorrect behavior in nested collapsible components, as they would inherit the variable from their parent, leading to unexpected animations.

Problem
When a Collapsible content node has no height (e.g., empty content), the --radix-collapsible-content-height variable is missing. In a nested collapsible structure, child nodes without content inherit the variable from their parent, resulting in incorrect animations or unexpected visual behavior.

Solution
This PR ensures that the --radix-collapsible-content-height CSS variable is always defined on the content node, even when the height is zero. Specifically:
When the height of a Collapsible content is zero, the variable is explicitly set to --radix-collapsible-content-height: 0.

Changes
Updated logic to always define the --radix-collapsible-content-height variable on collapsible content, regardless of its height.
Added tests to verify that the variable is correctly applied when content height is zero.
Included an update to the documentation for developers to clarify the behavior of --radix-collapsible-content-height in nested structures.

@neo-schobert
Copy link
Author

Fixed #3037 (comment)

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