File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,8 @@ export const SuggestionMenu = ({
6767 ) ,
6868 )
6969
70- // Find the longest description to determine if we can use same-line layout
71- const maxDescriptionLength = Math . max (
72- ...visibleItems . map ( ( item ) => item . description . length ) ,
73- )
74-
75- // Check if all items can fit on same line with aligned descriptions
76- const minWidthForSameLine = maxLabelLength + 2 + maxDescriptionLength
77- const useSameLine = menuWidth >= minWidthForSameLine
70+ // Account for button padding (paddingLeft + paddingRight = 2)
71+ const availableWidth = menuWidth - 2
7872
7973 const renderSuggestionItem = ( item : SuggestionItem , idx : number ) => {
8074 const absoluteIndex = start + idx
@@ -92,7 +86,10 @@ export const SuggestionMenu = ({
9286 setHasHoveredSinceOpen ( true )
9387 }
9488
95- if ( useSameLine ) {
89+ // Check per-item if description fits on the same line (using maxLabelLength for alignment padding)
90+ const itemFitsOnSameLine = availableWidth >= maxLabelLength + 2 + item . description . length
91+
92+ if ( itemFitsOnSameLine ) {
9693 // Calculate padding to align descriptions
9794 const paddingLength = maxLabelLength - labelLength
9895 const padding = ' ' . repeat ( paddingLength )
You can’t perform that action at this time.
0 commit comments