File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -361,8 +361,15 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
361361 const measure = useCallback ( ( ) => {
362362 const { element : current , overflows : compact } = stateRef . current ;
363363 if ( ! current ) return ;
364- const available = current . clientWidth ;
365- if ( available === 0 ) return ;
364+ if ( current . clientWidth === 0 ) return ;
365+ // The strip's own padding is not room for its children. Counting it let
366+ // labels expand while the composer controls hosted here had already
367+ // collapsed to icons for lack of space.
368+ const stripStyle = getComputedStyle ( current ) ;
369+ const available =
370+ current . clientWidth -
371+ ( Number . parseFloat ( stripStyle . paddingInlineStart ) || 0 ) -
372+ ( Number . parseFloat ( stripStyle . paddingInlineEnd ) || 0 ) ;
366373 // flex-1 stretches the groups to fill the strip, so their own boxes always
367374 // measure "full". Sum the laid-out content instead, skipping hidden form
368375 // artifacts and other out-of-flow nodes.
@@ -384,7 +391,7 @@ function useLabelsOverflow(element: HTMLDivElement | null): boolean {
384391 }
385392 return width + gap * Math . max ( 0 , counted - 1 ) ;
386393 } ;
387- const stripGap = Number . parseFloat ( getComputedStyle ( current ) . columnGap ) || 0 ;
394+ const stripGap = Number . parseFloat ( stripStyle . columnGap ) || 0 ;
388395 let needed = 0 ;
389396 let groups = 0 ;
390397 for ( const child of current . children ) {
You can’t perform that action at this time.
0 commit comments