Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/ChatBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,17 @@ export function ChatBubble({
if (target) activateCitation(null);
};
const onAnswerClick = (e: React.MouseEvent<HTMLDivElement>) => {
// Scope to inline citation anchors only. Source-row buttons in the
// footer also carry `data-citation` (for hover-link highlighting) and
// own their own click handler; matching them here would double-fire
// `open_url`, opening the URL twice in the browser.
const target = (e.target as HTMLElement).closest(
'[data-citation]',
'a[data-citation]',
) as HTMLElement | null;
if (!target) return;
e.preventDefault();
// `data-url` is always set when we build citation anchors in wrapCitations
// and on source pills at render time, so the non-null assertion is safe.
// `data-url` is always set when we build citation anchors in wrapCitations,
// so the non-null assertion is safe.
void invoke('open_url', { url: target.getAttribute('data-url')! });
};

Expand Down