@@ -15,7 +15,6 @@ import React, {
1515 type SetStateAction ,
1616 type ReactNode ,
1717} from 'react' ;
18- import useIsBrowser from '@docusaurus/useIsBrowser' ;
1918import useIsomorphicLayoutEffect from '@docusaurus/useIsomorphicLayoutEffect' ;
2019import { prefersReducedMotion } from '../../utils/accessibilityUtils' ;
2120
@@ -157,24 +156,6 @@ type CollapsibleElementType = React.ElementType<
157156 Pick < React . HTMLAttributes < unknown > , 'className' | 'onTransitionEnd' | 'style' >
158157> ;
159158
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-
178159type CollapsibleBaseProps = {
179160 /** The actual DOM element to be used in the markup. */
180161 as ?: CollapsibleElementType ;
@@ -192,12 +173,6 @@ type CollapsibleBaseProps = {
192173 onCollapseTransitionEnd ?: ( collapsed : boolean ) => void ;
193174 /** Class name for the underlying DOM element. */
194175 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 ;
201176} ;
202177
203178function CollapsibleBase ( {
@@ -207,9 +182,7 @@ function CollapsibleBase({
207182 animation,
208183 onCollapseTransitionEnd,
209184 className,
210- disableSSRStyle,
211185} : CollapsibleBaseProps ) {
212- const isBrowser = useIsBrowser ( ) ;
213186 const collapsibleRef = useRef < HTMLElement > ( null ) ;
214187
215188 useCollapseAnimation ( { collapsibleRef, collapsed, animation} ) ;
@@ -219,8 +192,6 @@ function CollapsibleBase({
219192 // @ts -expect-error: the "too complicated type" is produced from
220193 // "CollapsibleElementType" being a huge union
221194 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} ) }
224195 onTransitionEnd = { ( e : React . TransitionEvent ) => {
225196 if ( e . propertyName !== 'height' ) {
226197 return ;
0 commit comments