-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
v6: Add animation for expanding/collapsing accordions #42047
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
base: v6-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -102,6 +102,16 @@ $accordion-icon-transform: rotate(-180deg) !default; | |||||||||||||||||||||||||||||||||||
| background-color: var(--accordion-bg); | ||||||||||||||||||||||||||||||||||||
| border: var(--accordion-border-width) solid var(--accordion-border-color); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @media (prefers-reduced-motion: no-preference) { | ||||||||||||||||||||||||||||||||||||
| interpolate-size: allow-keywords; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
coliff marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| &::details-content { | ||||||||||||||||||||||||||||||||||||
| block-size: 0; | ||||||||||||||||||||||||||||||||||||
| overflow-y: clip; | ||||||||||||||||||||||||||||||||||||
| @include transition(content-visibility .2s allow-discrete, block-size .2s); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+107
to
+112
|
||||||||||||||||||||||||||||||||||||
| } | |
| &::details-content { | |
| block-size: 0; | |
| overflow-y: clip; | |
| @include transition(content-visibility .2s allow-discrete, block-size .2s); | |
| &::details-content { | |
| @include transition(content-visibility .2s allow-discrete, block-size .2s); | |
| } | |
| } | |
| &::details-content { | |
| block-size: 0; | |
| overflow-y: clip; |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The transition includes content-visibility as a transitioning property. However, content-visibility is not an animatable CSS property according to the CSS specification. While the allow-discrete keyword enables transitions for discrete properties, content-visibility is not listed as a property that can be transitioned even with this keyword. This will likely not produce the intended animation effect. The intended property for animating the visibility of details content is typically handled through height or block-size transitions, which is already included.
| @include transition(content-visibility .2s allow-discrete, block-size .2s); | |
| @include transition(block-size .2s); |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ::details-content pseudo-element only applies to HTML <details> elements. However, the current codebase shows that .accordion-item is implemented as a <div> element (see site/src/assets/examples/cheatsheet/index.astro lines 607, 619, 631). This CSS will not work unless the HTML structure is changed to use <details> elements instead of <div> elements. If this PR is meant to transition accordions to use the native <details> element, then corresponding HTML changes should be included in this PR or clearly documented.
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The &[open] selector is specific to the <details> element's open attribute. Since the current accordion implementation uses <div> elements, this selector will not match anything. The existing code uses classes like .show or .collapse for managing accordion state. If transitioning to <details> elements, the HTML structure needs to be updated accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
interpolate-sizeCSS property is a very recent addition to the CSS specification and is currently only supported in Chromium 129+ (released September 2024). It's not yet supported in Firefox or Safari as of January 2025. Since this is a cutting-edge feature with limited browser support, consider adding a comment documenting the browser compatibility requirements and fallback behavior for unsupported browsers.