@@ -28,7 +28,7 @@ function Collapsible(props: {
28
28
keepMounted = true ,
29
29
defaultOpen = false ,
30
30
id,
31
- hiddenUntilFound : hiddenUntilFoundProp = false ,
31
+ hiddenUntilFound : hiddenUntilFoundProp = true ,
32
32
} = props ;
33
33
34
34
const [ open , setOpen ] = React . useState ( defaultOpen ) ;
@@ -333,7 +333,7 @@ function Collapsible(props: {
333
333
334
334
setHeight ( panel . scrollHeight ) ;
335
335
336
- if ( ! shouldCancelInitialOpenAnimationRef . current ) {
336
+ if ( ! shouldCancelInitialOpenAnimationRef . current && ! isBeforeMatchRef . current ) {
337
337
panel . style . removeProperty ( 'animation-name' ) ;
338
338
}
339
339
@@ -358,12 +358,7 @@ function Collapsible(props: {
358
358
useEnhancedEffect ( ( ) => {
359
359
const panel = panelRef . current ;
360
360
361
- if (
362
- panel &&
363
- hiddenUntilFoundProp &&
364
- animationTypeRef . current === 'css-transition' &&
365
- isHidden
366
- ) {
361
+ if ( panel && hiddenUntilFoundProp && isHidden ) {
367
362
/**
368
363
* React only supports a boolean for the `hidden` attribute and forces
369
364
* legit string values to booleans so we have to force it back in the DOM
@@ -376,7 +371,9 @@ function Collapsible(props: {
376
371
* to `'until-found'` as they could have different `display` properties:
377
372
* https://github.com/tailwindlabs/tailwindcss/pull/14625
378
373
*/
379
- panel . setAttribute ( 'data-starting-style' , '' ) ;
374
+ if ( animationTypeRef . current === 'css-transition' ) {
375
+ panel . setAttribute ( 'data-starting-style' , '' ) ;
376
+ }
380
377
}
381
378
} , [ hiddenUntilFoundProp , isHidden ] ) ;
382
379
0 commit comments