@@ -7,6 +7,7 @@ import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal
77
88import { useAppLayoutToolbarEnabled } from '../app-layout/utils/feature-flags' ;
99import { useSplitPanelContext } from '../internal/context/split-panel-context' ;
10+ import * as tokens from '../internal/generated/styles/tokens' ;
1011import { useMobile } from '../internal/hooks/use-mobile' ;
1112import { useVisualRefresh } from '../internal/hooks/use-visual-mode' ;
1213import { SplitPanelContentProps } from './interfaces' ;
@@ -45,7 +46,14 @@ export function SplitPanelContentBottom({
4546 const isMobile = useMobile ( ) ;
4647
4748 const headerRef = useRef < HTMLDivElement > ( null ) ;
48- useResizeObserver ( headerRef , entry => reportHeaderHeight ( entry . borderBoxHeight ) ) ;
49+ const closedPanelBlockSize = useRef < string > ( ) ;
50+
51+ useResizeObserver ( headerRef , entry => {
52+ const { borderBoxHeight } = entry ;
53+ closedPanelBlockSize . current = `calc(${ borderBoxHeight } px + ${ tokens . borderPanelTopWidth } )` ;
54+ reportHeaderHeight ( borderBoxHeight ) ;
55+ } ) ;
56+
4957 useEffect ( ( ) => {
5058 // report empty height when unmounting the panel
5159 return ( ) => reportHeaderHeight ( 0 ) ;
@@ -75,7 +83,7 @@ export function SplitPanelContentBottom({
7583 insetBlockEnd : bottomOffset ,
7684 insetInlineStart : leftOffset ,
7785 insetInlineEnd : rightOffset ,
78- blockSize : isOpen ? cappedSize : undefined ,
86+ blockSize : isOpen ? cappedSize : isToolbar ? closedPanelBlockSize . current : undefined ,
7987 } }
8088 ref = { splitPanelRef }
8189 >
0 commit comments