diff --git a/packages/ui/src/components/ui/sortable-tabs-strip.tsx b/packages/ui/src/components/ui/sortable-tabs-strip.tsx index 33e5c7e5..b0e199be 100644 --- a/packages/ui/src/components/ui/sortable-tabs-strip.tsx +++ b/packages/ui/src/components/ui/sortable-tabs-strip.tsx @@ -366,6 +366,7 @@ export const SortableTabsStrip: React.FC = ({ const shouldShowLabel = !showInactiveIconOnly; const useIntrinsicActiveTab = inactiveTabsIconOnly && usesActivePillIndicator && isActive && !isScrollable && !useIntrinsicPillSizing; const closable = item.closable !== false && Boolean(onClose); + const closeReplacesIcon = closable && Boolean(item.icon); const wrapperClassName = (isScrollable || useIntrinsicPillSizing) ? undefined : usesActivePillIndicator @@ -401,7 +402,6 @@ export const SortableTabsStrip: React.FC = ({ usesActivePillIndicator ? 'animated-tabs__button pill-tabs__button relative z-10 flex flex-1 items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0' : 'flex h-full min-w-0 items-center typography-micro', - usesActivePillIndicator && closable && '!flex-none', usesActivePillIndicator && activePillLowercase ? 'lowercase' : null, usesActivePillIndicator && (showInactiveIconOnly ? 'gap-0' : 'gap-1.5'), usesActivePillIndicator @@ -433,7 +433,29 @@ export const SortableTabsStrip: React.FC = ({ > {usesActivePillIndicator ? ( <> - {item.icon ? {item.icon} : null} + {item.icon ? ( + + {item.icon} + {closeReplacesIcon ? ( + { + event.stopPropagation(); + }} + onClick={(event) => { + event.stopPropagation(); + onClose?.(item.id); + }} + aria-label={item.closeLabel ?? `Close ${item.label} tab`} + title={item.closeLabel ?? `Close ${item.label} tab`} + > + + + ) : null} + + ) : null} {shouldShowLabel ? {item.label} : null} ) : ( @@ -441,18 +463,36 @@ export const SortableTabsStrip: React.FC = ({ {item.icon ? ( - {item.icon} + {item.icon} + {closeReplacesIcon ? ( + { + event.stopPropagation(); + }} + onClick={(event) => { + event.stopPropagation(); + onClose?.(item.id); + }} + aria-label={item.closeLabel ?? `Close ${item.label} tab`} + title={item.closeLabel ?? `Close ${item.label} tab`} + > + + + ) : null} ) : null} {item.label} )} - {closable ? ( + {closable && !closeReplacesIcon ? (