Skip to content

Commit b6c394b

Browse files
committed
Make whole citation item clickable
1 parent 033d1d0 commit b6c394b

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

ui/src/components/CitationList/CitationList.tsx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ const CitationItem = memo(function CitationItem({
9999
"hover:border-primary/50 hover:bg-muted/30"
100100
)}
101101
>
102-
<div className="flex items-center gap-2 px-3 py-2">
102+
<button
103+
type="button"
104+
className="flex items-center gap-2 px-3 py-2 w-full text-left cursor-pointer"
105+
onClick={hasExpandableContent ? onToggle : handleClick}
106+
aria-expanded={hasExpandableContent ? isExpanded : undefined}
107+
>
103108
{/* Icon */}
104109
{citation.type === "url" ? (
105110
<ExternalLink className="h-4 w-4 text-green-500 shrink-0" />
@@ -108,13 +113,9 @@ const CitationItem = memo(function CitationItem({
108113
)}
109114

110115
{/* Title/filename */}
111-
<button
112-
type="button"
113-
className="text-sm font-medium text-foreground hover:text-primary truncate text-left flex-1 min-w-0"
114-
onClick={handleClick}
115-
>
116+
<span className="text-sm font-medium text-foreground truncate text-left flex-1 min-w-0">
116117
{citation.type === "url" ? citation.title : citation.filename}
117-
</button>
118+
</span>
118119

119120
{/* Score badge */}
120121
{citation.score !== undefined && (
@@ -140,20 +141,13 @@ const CitationItem = memo(function CitationItem({
140141
</span>
141142
)}
142143

143-
{/* Expand button */}
144+
{/* Expand indicator */}
144145
{hasExpandableContent && (
145-
<Button
146-
variant="ghost"
147-
size="sm"
148-
className="h-6 w-6 p-0 shrink-0"
149-
onClick={onToggle}
150-
aria-label={isExpanded ? "Collapse citation" : "Expand citation"}
151-
aria-expanded={isExpanded}
152-
>
146+
<span className="h-6 w-6 flex items-center justify-center shrink-0">
153147
{isExpanded ? <ChevronUp className="h-3 w-3" /> : <ChevronDown className="h-3 w-3" />}
154-
</Button>
148+
</span>
155149
)}
156-
</div>
150+
</button>
157151

158152
{/* Expanded content */}
159153
{isExpanded && hasExpandableContent && (

0 commit comments

Comments
 (0)