@@ -12,7 +12,7 @@ import { formatSubagentDisplayTitle } from "@t3tools/client-runtime/state/subage
1212import { formatDuration } from "@t3tools/shared/orchestrationTiming" ;
1313import * as DateTime from "effect/DateTime" ;
1414import { CheckIcon , CircleDashedIcon , CircleXIcon , TerminalIcon } from "lucide-react" ;
15- import { useLayoutEffect , useRef , useState , type ReactNode } from "react" ;
15+ import { useLayoutEffect , useRef , useState , type ComponentProps } from "react" ;
1616
1717import { cn } from "~/lib/utils" ;
1818import { Button } from "../ui/button" ;
@@ -227,20 +227,24 @@ function Elapsed({ startedAtMs, endedAtMs }: { startedAtMs: number; endedAtMs: n
227227
228228const mutedText = "text-muted-foreground/70 light:text-muted-foreground" ;
229229
230- /** Truncated text whose full value stays reachable on hover. */
231- function FullText ( props : { text : string ; className : string ; children ?: ReactNode } ) {
230+ /** Shows a focusable row's untruncated text on hover and on keyboard focus. */
231+ function FullTextTooltip ( props : {
232+ lines : ReadonlyArray < string | null > ;
233+ render : ComponentProps < typeof TooltipTrigger > [ "render" ] ;
234+ } ) {
232235 return (
233236 < Tooltip >
234- < TooltipTrigger render = { < span className = { props . className } /> } >
235- { props . children ?? props . text }
236- </ TooltipTrigger >
237+ < TooltipTrigger render = { props . render } />
237238 < TooltipPopup side = "top" className = "max-w-[min(30rem,calc(100vw-2rem))] whitespace-normal" >
238- { props . text }
239+ { props . lines . map ( ( line ) => ( line ? < div key = { line } > { line } </ div > : null ) ) }
239240 </ TooltipPopup >
240241 </ Tooltip >
241242 ) ;
242243}
243244
245+ const focusRing =
246+ "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring" ;
247+
244248function Rows ( {
245249 rows,
246250 onOpenThread,
@@ -263,19 +267,17 @@ function Rows({
263267 < RowIcon row = { row } />
264268 </ span >
265269 < span className = "flex min-w-0 items-baseline gap-2" >
266- < FullText
267- text = { row . label }
270+ < span
268271 className = { cn (
269272 "min-w-0 truncate text-foreground" ,
270273 row . activity && "max-w-[40%] shrink-0 @max-[480px]:max-w-[55%]" ,
271274 row . kind === "command" && "font-mono" ,
272275 ) }
273- />
276+ >
277+ { row . label }
278+ </ span >
274279 { row . activity ? (
275- < FullText
276- text = { row . activity }
277- className = { cn ( "w-0 min-w-0 grow truncate" , mutedText ) }
278- />
280+ < span className = { cn ( "w-0 min-w-0 grow truncate" , mutedText ) } > { row . activity } </ span >
279281 ) : null }
280282 </ span >
281283 { row . status === "failed" ? (
@@ -294,20 +296,24 @@ function Rows({
294296 ) ;
295297 return (
296298 < li key = { row . key } >
297- { childThreadId === undefined ? (
298- < div className = { rowClassName } > { content } </ div >
299- ) : (
300- < button
301- type = "button"
302- className = { cn (
303- rowClassName ,
304- "cursor-pointer hover:bg-accent focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring" ,
305- ) }
306- onClick = { ( ) => onOpenThread ( childThreadId ) }
307- >
308- { content }
309- </ button >
310- ) }
299+ < FullTextTooltip
300+ lines = { [ row . label , row . activity ] }
301+ render = {
302+ childThreadId === undefined ? (
303+ < div tabIndex = { 0 } className = { cn ( rowClassName , focusRing ) } >
304+ { content }
305+ </ div >
306+ ) : (
307+ < button
308+ type = "button"
309+ className = { cn ( rowClassName , focusRing , "cursor-pointer hover:bg-accent" ) }
310+ onClick = { ( ) => onOpenThread ( childThreadId ) }
311+ >
312+ { content }
313+ </ button >
314+ )
315+ }
316+ />
311317 </ li >
312318 ) ;
313319 } ) }
@@ -342,10 +348,7 @@ export function BackgroundWorkBanner(props: {
342348 < HeaderIcon rows = { presentation . rows } />
343349 </ ComposerBanner . Icon >
344350 < ComposerBanner . Content className = "whitespace-nowrap" >
345- < FullText
346- text = { single ?. kind === "command" ? single . label : presentation . title }
347- className = "min-w-0 truncate font-medium leading-7 sm:leading-6"
348- >
351+ < span className = "min-w-0 truncate font-medium leading-7 sm:leading-6" >
349352 { single ?. kind === "command" ? (
350353 < >
351354 { presentation . waiting ? "Waiting on " : "Running " }
@@ -354,12 +357,11 @@ export function BackgroundWorkBanner(props: {
354357 ) : (
355358 presentation . title
356359 ) }
357- </ FullText >
360+ </ span >
358361 { description && ( single || ! expanded ) ? (
359- < FullText
360- text = { description }
361- className = { cn ( "w-0 min-w-0 grow truncate @max-[400px]:sr-only" , mutedText ) }
362- />
362+ < span className = { cn ( "w-0 min-w-0 grow truncate @max-[400px]:sr-only" , mutedText ) } >
363+ { description }
364+ </ span >
363365 ) : null }
364366 </ ComposerBanner . Content >
365367 < ComposerBanner . Actions className = "flex-nowrap" >
@@ -382,19 +384,25 @@ export function BackgroundWorkBanner(props: {
382384 { presentation . title }
383385 </ span >
384386 < div className = "flex items-center" >
385- { single ? (
386- < ComposerBanner . Row className = "flex-1" > { header } </ ComposerBanner . Row >
387- ) : (
388- < ComposerBanner . Row
389- render = { < button type = "button" /> }
390- aria-expanded = { expanded }
391- aria-label = { `${ presentation . title } . ${ expanded ? "Hide" : "Show" } details` }
392- className = "flex-1"
393- onClick = { ( ) => setExpanded ( ( value ) => ! value ) }
394- >
395- { header }
396- </ ComposerBanner . Row >
397- ) }
387+ < FullTextTooltip
388+ lines = { [ single ?. kind === "command" ? single . label : presentation . title , description ] }
389+ render = {
390+ single ? (
391+ < ComposerBanner . Row tabIndex = { 0 } className = { cn ( "flex-1 rounded-md" , focusRing ) } >
392+ { header }
393+ </ ComposerBanner . Row >
394+ ) : (
395+ < ComposerBanner . Row
396+ render = { < button type = "button" /> }
397+ aria-expanded = { expanded }
398+ className = "flex-1"
399+ onClick = { ( ) => setExpanded ( ( value ) => ! value ) }
400+ >
401+ { header }
402+ </ ComposerBanner . Row >
403+ )
404+ }
405+ />
398406 < span className = "flex gap-1 ps-0.5" >
399407 { singleThreadId === undefined ? null : (
400408 < Button size = "xs" variant = "ghost-muted" onClick = { ( ) => onOpenThread ( singleThreadId ) } >
0 commit comments