File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -505,18 +505,19 @@ export class ActionMenuElement extends HTMLElement {
505505 this . #originalLabel ||= invokerLabel . textContent || ''
506506 let itemLabel : string | undefined
507507 if ( this . selectVariant === 'single' ) {
508- itemLabel = this . querySelector ( '[aria-checked=true] .ActionListItem-label' ) ?. textContent
508+ itemLabel = this . querySelector ( '[aria-checked=true] .ActionListItem-label' ) ?. textContent ?. trim ( )
509509 } else if ( this . selectVariant === 'multiple' ) {
510510 itemLabel = Array . from ( this . querySelectorAll ( `[aria-checked=true] .ActionListItem-label` ) )
511- . map ( label => label . textContent . trim ( ) )
511+ . map ( label => ( label . textContent || '' ) . trim ( ) )
512+ . filter ( Boolean )
512513 . join ( ', ' )
513514 }
514515 itemLabel ||= this . #originalLabel
515516 if ( itemLabel && this . dynamicLabel ) {
516517 const prefixSpan = document . createElement ( 'span' )
517518 prefixSpan . classList . add ( 'color-fg-muted' )
518519 const contentSpan = document . createElement ( 'span' )
519- prefixSpan . textContent = `${ this . dynamicLabelPrefix } `
520+ prefixSpan . textContent = this . dynamicLabelPrefix ? `${ this . dynamicLabelPrefix } ` : ''
520521 contentSpan . textContent = itemLabel
521522 invokerLabel . replaceChildren ( prefixSpan , contentSpan )
522523 } else {
You can’t perform that action at this time.
0 commit comments