🐛 tooltip hovering

This commit is contained in:
2026-03-17 11:01:59 +10:00
parent 6567f1977a
commit 416c6c0d5c
3 changed files with 27 additions and 3 deletions

View File

@@ -173,6 +173,7 @@
} }
.annotation-tooltip { .annotation-tooltip {
position: relative;
background: var(--message-bg); background: var(--message-bg);
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 6px; border-radius: 6px;
@@ -184,6 +185,20 @@
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
} }
/* Invisible bridge that extends CodeMirror's isInTooltip() hit-area into the
gap between the card and the annotation text, preventing the card from
dismissing while the mouse travels between them. */
.annotation-tooltip > .cm-tooltip-arrow {
position: absolute;
bottom: -12px;
left: 0;
right: 0;
height: 12px;
pointer-events: none;
background: transparent;
border: none;
}
.annotation-tooltip-divider { .annotation-tooltip-divider {
height: 1px; height: 1px;
background: var(--border); background: var(--border);

View File

@@ -209,7 +209,8 @@ const annotationHoverTooltip = hoverTooltip(
// User comments: show static tooltip with the comment text — no AI streaming // User comments: show static tooltip with the comment text — no AI streaming
if (ann.type === 'user_comment') { if (ann.type === 'user_comment') {
return { return {
pos, pos: ann.from,
end: ann.to,
above: true, above: true,
create() { create() {
const dom = document.createElement('div') const dom = document.createElement('div')
@@ -234,13 +235,17 @@ const annotationHoverTooltip = hoverTooltip(
body.className = 'annotation-tooltip-body' body.className = 'annotation-tooltip-body'
body.textContent = ann.comment ?? ann.message body.textContent = ann.comment ?? ann.message
dom.appendChild(body) dom.appendChild(body)
const bridge = document.createElement('div')
bridge.className = 'cm-tooltip-arrow'
dom.appendChild(bridge)
return { dom, destroy() {} } return { dom, destroy() {} }
} }
} }
} }
return { return {
pos, pos: ann.from,
end: ann.to,
above: true, above: true,
create() { create() {
const dom = document.createElement('div') const dom = document.createElement('div')
@@ -302,6 +307,10 @@ const annotationHoverTooltip = hoverTooltip(
} }
}) })
const bridge = document.createElement('div')
bridge.className = 'cm-tooltip-arrow'
dom.appendChild(bridge)
return { dom, destroy() { cancelAnalysis() } } return { dom, destroy() { cancelAnalysis() } }
} }
} }

File diff suppressed because one or more lines are too long