Skip to content

Commit 868eccf

Browse files
committed
Fixes graph hover out on graph background
1 parent 7374dff commit 868eccf

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010

1111
- Fixes Git diff of a renamed file is shown as a new file ([#4246](https://github.com/gitkraken/vscode-gitlens/issues/4246))
1212
- Fixes typos ([#4345](https://github.com/gitkraken/vscode-gitlens/issues/4345) — thanks to [PR #4346](https://github.com/gitkraken/vscode-gitlens/pull/4346) by Noritaka Kobayashi ([@noritaka1166](https://github.com/noritaka1166)))
13+
- Fixes issue where the _Commit Graph_ hover would not hide when going from the hover to the graph background (not another row)
1314

1415
## [17.5.1] - 2025-09-24
1516

src/webviews/apps/plus/graph/hover/graphHover.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ export class GlGraphHover extends GlElement {
8383
window.removeEventListener('keydown', this.onWindowKeydown);
8484
}
8585

86+
override firstUpdated(): void {
87+
// Add mouseleave listener to the popover to handle when mouse moves from hover to graph background
88+
this.popup?.addEventListener('mouseleave', this.onPopoverMouseLeave);
89+
}
90+
8691
override render(): unknown {
8792
return html`<gl-popover
8893
?open=${this.open}
@@ -134,6 +139,20 @@ export class GlGraphHover extends GlElement {
134139
this.hide();
135140
};
136141

142+
private onPopoverMouseLeave = (e: MouseEvent) => {
143+
// When mouse leaves the popover, check if it's going to a graph row or staying within the hover component
144+
const relatedTarget = e.relatedTarget;
145+
if (relatedTarget != null && relatedTarget instanceof HTMLElement) {
146+
// Don't hide if moving to another part of the hover component
147+
if (relatedTarget.closest('gl-graph-hover')) return;
148+
}
149+
150+
// Use a small delay to allow row hover events to fire first
151+
// If moving to another row, the row hover event will cancel this timer and show the new hover
152+
// If moving to graph background, this timer will hide the hover
153+
this.unhoverTimer = setTimeout(() => this.hide(), 100);
154+
};
155+
137156
private _showCoreDebounced: Deferrable<GlGraphHover['showCore']> | undefined = undefined;
138157

139158
onRowHovered(row: GraphRow, anchor: Anchor): void {

0 commit comments

Comments
 (0)