@@ -80,15 +80,15 @@ export function VirtualElement({
80
80
const styleObj = useMemo < React . CSSProperties > (
81
81
( ) => ( {
82
82
width : width ?? 'auto' ,
83
- height : ( placeholderHeight ?? '0' ) + 'px' ,
83
+ height : ( ( placeholderHeight || ref ?. clientHeight ) ?? '0' ) + 'px' ,
84
84
marginTop : 0 ,
85
85
marginLeft : 0 ,
86
86
marginRight : 0 ,
87
87
marginBottom : 0 ,
88
88
// These properties are used to ensure that if a prior element is changed from
89
89
// placeHolder to element, the position of visible elements are not affected.
90
90
contentVisibility : 'auto' ,
91
- containIntrinsicSize : `0 ${ placeholderHeight ?? '0' } px` ,
91
+ containIntrinsicSize : `0 ${ ( placeholderHeight || ref ?. clientHeight ) ?? '0' } px` ,
92
92
contain : 'size layout' ,
93
93
} ) ,
94
94
[ width , placeholderHeight ]
@@ -368,20 +368,16 @@ function measureElement(wrapperEl: HTMLDivElement, placeholderHeight?: number):
368
368
const el = wrapperEl . firstElementChild as HTMLElement
369
369
const style = window . getComputedStyle ( el )
370
370
371
- const timelineWrapper = el . closest ( '.segment-timeline-wrapper--shelf' )
371
+ let segmentTimeline : Element | null = null
372
+ let dashboardPanel : Element | null = null
372
373
373
- if ( timelineWrapper ) {
374
- let totalHeight = 0
374
+ segmentTimeline = wrapperEl . querySelector ( '.segment-timeline' )
375
+ dashboardPanel = wrapperEl . querySelector ( '.dashboard-panel' )
375
376
376
- // Get the segment timeline height
377
- const segmentTimeline = timelineWrapper . querySelector ( '.segment-timeline' )
378
- if ( segmentTimeline ) {
379
- const segmentRect = segmentTimeline . getBoundingClientRect ( )
380
- totalHeight = segmentRect . height
381
- }
377
+ if ( segmentTimeline ) {
378
+ const segmentRect = segmentTimeline . getBoundingClientRect ( )
379
+ let totalHeight = segmentRect . height
382
380
383
- // Add the dashboard panel height if it exists
384
- const dashboardPanel = timelineWrapper . querySelector ( '.dashboard-panel' )
385
381
if ( dashboardPanel ) {
386
382
const panelRect = dashboardPanel . getBoundingClientRect ( )
387
383
totalHeight += panelRect . height
0 commit comments