@@ -74,17 +74,17 @@ function PlainCollapsible(props: { defaultOpen?: boolean; keepMounted?: boolean
74
74
element . style . setProperty ( 'display' , 'block' , 'important' ) ; // TODO: maybe this can be set more conditionally
75
75
76
76
if ( height === undefined ) {
77
+ // the closed transition styles must be set here to transition the first
78
+ // opening transition when the panel is BOTH initially closed AND `keepMounted={false}`
77
79
if ( ! shouldCancelInitialOpenTransitionRef . current && ! keepMounted ) {
78
- // the closed transition styles must be set here to transition the first
79
- // opening transition when the panel is BOTH initially closed AND `keepMounted={false}`
80
- // console.log('handlePanelRef setting opacity 0');
81
- // element.style.opacity = '0';
80
+ console . log ( 'handlePanelRef setting opacity 0' ) ;
81
+ element . style . opacity = '0' ;
82
82
83
83
setHeightAndRemoveDisplayProperty ( element ) ;
84
84
85
85
// after setHeight() all the transition properties need to be removed
86
86
// console.log('handlePanelRef unsetting inline opacity');
87
- // element.style.removeProperty('opacity');
87
+ element . style . removeProperty ( 'opacity' ) ;
88
88
} else {
89
89
setHeightAndRemoveDisplayProperty ( element ) ;
90
90
}
@@ -181,12 +181,6 @@ function PlainCollapsible(props: { defaultOpen?: boolean; keepMounted?: boolean
181
181
182
182
/* opening */
183
183
panel . style . height = '0px' ;
184
- // the closed transition styles must be set here to transition all opening
185
- // transitions except the first one when `keepMounted={false}`
186
- if ( ! shouldCancelInitialOpenTransitionRef . current ) {
187
- // console.log('useEnhancedEffect setting opacity 0');
188
- // panel.style.opacity = '0';
189
- }
190
184
191
185
requestAnimationFrame ( ( ) => {
192
186
// this is the earliest opportunity to unset the `display` property
@@ -195,12 +189,6 @@ function PlainCollapsible(props: { defaultOpen?: boolean; keepMounted?: boolean
195
189
196
190
panel . style . removeProperty ( 'height' ) ;
197
191
198
- if ( ! shouldCancelInitialOpenTransitionRef . current ) {
199
- // remove all the transition properties that were just manually applied
200
- // console.log('useEnhancedEffect unsetting inline opacity');
201
- // panel.style.removeProperty('opacity');
202
- }
203
-
204
192
setHeight ( panel . scrollHeight ) ;
205
193
} ) ;
206
194
} else {
0 commit comments