@@ -15,7 +15,6 @@ import React, {
15
15
type SetStateAction ,
16
16
type ReactNode ,
17
17
} from 'react' ;
18
- import useIsBrowser from '@docusaurus/useIsBrowser' ;
19
18
import useIsomorphicLayoutEffect from '@docusaurus/useIsomorphicLayoutEffect' ;
20
19
import { prefersReducedMotion } from '../../utils/accessibilityUtils' ;
21
20
@@ -157,24 +156,6 @@ type CollapsibleElementType = React.ElementType<
157
156
Pick < React . HTMLAttributes < unknown > , 'className' | 'onTransitionEnd' | 'style' >
158
157
> ;
159
158
160
- /**
161
- * Prevent hydration layout shift before animations are handled imperatively
162
- * with JS
163
- */
164
- function getSSRStyle ( {
165
- collapsed,
166
- isBrowser,
167
- } : {
168
- collapsed : boolean ;
169
- isBrowser : boolean ;
170
- } ) {
171
- // After hydration, styles are applied
172
- if ( isBrowser ) {
173
- return undefined ;
174
- }
175
- return collapsed ? CollapsedStyles : ExpandedStyles ;
176
- }
177
-
178
159
type CollapsibleBaseProps = {
179
160
/** The actual DOM element to be used in the markup. */
180
161
as ?: CollapsibleElementType ;
@@ -192,12 +173,6 @@ type CollapsibleBaseProps = {
192
173
onCollapseTransitionEnd ?: ( collapsed : boolean ) => void ;
193
174
/** Class name for the underlying DOM element. */
194
175
className ?: string ;
195
- /**
196
- * This is mostly useful for details/summary component where ssrStyle is not
197
- * needed (as details are hidden natively) and can mess up with the browser's
198
- * native behavior when JS fails to load or is disabled
199
- */
200
- disableSSRStyle ?: boolean ;
201
176
} ;
202
177
203
178
function CollapsibleBase ( {
@@ -207,9 +182,7 @@ function CollapsibleBase({
207
182
animation,
208
183
onCollapseTransitionEnd,
209
184
className,
210
- disableSSRStyle,
211
185
} : CollapsibleBaseProps ) {
212
- const isBrowser = useIsBrowser ( ) ;
213
186
const collapsibleRef = useRef < HTMLElement > ( null ) ;
214
187
215
188
useCollapseAnimation ( { collapsibleRef, collapsed, animation} ) ;
@@ -219,8 +192,6 @@ function CollapsibleBase({
219
192
// @ts -expect-error: the "too complicated type" is produced from
220
193
// "CollapsibleElementType" being a huge union
221
194
ref = { collapsibleRef as RefObject < never > } // Refs are contravariant, which is not expressible in TS
222
- // Not even sure we need this SSRStyle anymore, try to remove it?
223
- style = { disableSSRStyle ? undefined : getSSRStyle ( { collapsed, isBrowser} ) }
224
195
onTransitionEnd = { ( e : React . TransitionEvent ) => {
225
196
if ( e . propertyName !== 'height' ) {
226
197
return ;
0 commit comments