@@ -54,6 +54,7 @@ import { |
54 | 54 | } from "lucide-react"; |
55 | 55 | import { |
56 | 56 | memo, |
| 57 | + useId, |
57 | 58 | useRef, |
58 | 59 | useState, |
59 | 60 | type KeyboardEvent as ReactKeyboardEvent, |
@@ -132,22 +133,41 @@ export type SidebarProviderEntry = Pick< |
132 | 133 | | "acpRegistryIconUrl" |
133 | 134 | | "models" |
134 | 135 | >; |
135 | | -function ThreadPorts({ thread }: { thread: SidebarThreadSummary }) { |
| 136 | +function ThreadPorts({ |
| 137 | + thread, |
| 138 | + descriptionId, |
| 139 | +}: { |
| 140 | + thread: SidebarThreadSummary; |
| 141 | + descriptionId: string; |
| 142 | +}) { |
136 | 143 | const enabled = useClientSettings((settings) => settings.sidebarShowPorts); |
137 | 144 | const servers = useThreadDiscoveredPorts({ |
138 | 145 | environmentId: enabled ? thread.environmentId : null, |
139 | 146 | threadId: thread.id, |
140 | 147 | }); |
141 | 148 | const ports = [...new Set(servers.map((server) => server.port))].sort((a, b) => a - b); |
142 | 149 | if (ports.length === 0) return null; |
| 150 | + const description = `Running ports: ${ports.join(", ")}`; |
143 | 151 | return ( |
144 | | - <span |
145 | | - className="inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground tabular-nums" |
146 | | - aria-label={`Running ports: ${ports.join(", ")}`} |
147 | | - > |
148 | | - <NetworkIcon aria-hidden="true" className="size-3" /> |
149 | | - {ports.join(", ")} |
150 | | - </span> |
| 152 | + <> |
| 153 | + <span id={descriptionId} className="sr-only"> |
| 154 | + {description} |
| 155 | + </span> |
| 156 | + <Tooltip> |
| 157 | + <TooltipTrigger |
| 158 | + render={ |
| 159 | + <span |
| 160 | + aria-hidden="true" |
| 161 | + className="inline-flex max-w-[40%] shrink-0 items-center gap-1 text-xs text-muted-foreground tabular-nums" |
| 162 | + /> |
| 163 | + } |
| 164 | + > |
| 165 | + <NetworkIcon className="size-3 shrink-0" /> |
| 166 | + <span className="min-w-0 truncate">{ports.join(", ")}</span> |
| 167 | + </TooltipTrigger> |
| 168 | + <TooltipPopup>{description}</TooltipPopup> |
| 169 | + </Tooltip> |
| 170 | + </> |
151 | 171 | ); |
152 | 172 | } |
153 | 173 |
|
@@ -675,6 +695,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
675 | 695 | variant, |
676 | 696 | variantAction, |
677 | 697 | } = props; |
| 698 | + const portsDescriptionId = useId(); |
678 | 699 | const threadRef = scopeThreadRef(thread.environmentId, thread.id); |
679 | 700 | const threadKey = scopedThreadKey(threadRef); |
680 | 701 | const canOperateThread = useEnvironmentScope(thread.environmentId, AuthOrchestrationOperateScope); |
@@ -1235,6 +1256,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
1235 | 1256 | data-sidebar-row={threadKey} |
1236 | 1257 | data-sidebar-parent={props.navigationParent} |
1237 | 1258 | aria-label={accessibility.label} |
| 1259 | + aria-describedby={portsDescriptionId} |
1238 | 1260 | aria-current={accessibility.current} |
1239 | 1261 | data-testid={inFolder ? "sidebar-row-folder" : "sidebar-row-slim"} |
1240 | 1262 | aria-busy={isRegeneratingTitle || undefined} |
@@ -1271,7 +1293,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
1271 | 1293 | )} |
1272 | 1294 | {draftIndicator} |
1273 | 1295 | {title} |
1274 | | - <ThreadPorts thread={thread} /> |
| 1296 | + <ThreadPorts thread={thread} descriptionId={portsDescriptionId} /> |
1275 | 1297 | {multiline ? titleLineIcons : null} |
1276 | 1298 | {pinIndicator} |
1277 | 1299 | {multiline ? null : terminalStatusIcon} |
@@ -1432,6 +1454,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
1432 | 1454 | data-sidebar-row={threadKey} |
1433 | 1455 | data-sidebar-parent={props.navigationParent} |
1434 | 1456 | aria-label={accessibility.label} |
| 1457 | + aria-describedby={portsDescriptionId} |
1435 | 1458 | aria-current={accessibility.current} |
1436 | 1459 | data-testid="sidebar-row-card" |
1437 | 1460 | aria-busy={isRegeneratingTitle || undefined} |
@@ -1597,7 +1620,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
1597 | 1620 | </div> |
1598 | 1621 | <div className="mt-1 flex min-w-0 items-center gap-1.5"> |
1599 | 1622 | {title} |
1600 | | - <ThreadPorts thread={thread} /> |
| 1623 | + <ThreadPorts thread={thread} descriptionId={portsDescriptionId} /> |
1601 | 1624 | {isRegeneratingTitle ? ( |
1602 | 1625 | <span role="status" className="sr-only"> |
1603 | 1626 | Regenerating title |
@@ -1655,6 +1678,7 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props |
1655 | 1678 | projectDisplayName: props.projectDisplayName, |
1656 | 1679 | isActive: props.isRouteActive, |
1657 | 1680 | }); |
| 1681 | + const portsDescriptionId = useId(); |
1658 | 1682 | const threadRef = scopeThreadRef(thread.environmentId, thread.id); |
1659 | 1683 | const { leaseLiveStatus, rowRef } = useSidebarRowSubscriptionLease( |
1660 | 1684 | props.isHighlighted || props.isRouteActive, |
@@ -1721,7 +1745,7 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props |
1721 | 1745 | tabIndex={-1} |
1722 | 1746 | aria-selected={props.isHighlighted} |
1723 | 1747 | aria-current={accessibility.current} |
1724 | | - aria-describedby={`${props.resultId}-pr`} |
| 1748 | + aria-describedby={`${props.resultId}-pr ${portsDescriptionId}`} |
1725 | 1749 | aria-label={accessibility.label} |
1726 | 1750 | onMouseMove={props.onHighlight} |
1727 | 1751 | onClick={props.onSelect} |
@@ -1762,7 +1786,7 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props |
1762 | 1786 | > |
1763 | 1787 | {thread.title} |
1764 | 1788 | </span> |
1765 | | - <ThreadPorts thread={thread} /> |
| 1789 | + <ThreadPorts thread={thread} descriptionId={portsDescriptionId} /> |
1766 | 1790 | <span id={`${props.resultId}-pr`} className="contents"> |
1767 | 1791 | <ThreadSearchPullRequestNumber |
1768 | 1792 | thread={thread} |
|