Skip to content

Commit be6c660

Browse files
committed
mhutchie#132 make context menu fixed to prevent overlapping
1 parent 4757404 commit be6c660

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

web/contextMenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ContextMenu {
8383
? 2 - menuBounds.height // context menu fits above
8484
: -2 - (menuBounds.height - (frameBounds.height - (event.pageY - frameBounds.top))); // Overlap the context menu vertically with the cursor
8585
menu.style.left = (frameElem.scrollLeft + Math.max(event.pageX - frameBounds.left + relativeX, 2)) + 'px';
86-
menu.style.top = (frameElem.scrollTop + Math.max(event.pageY - frameBounds.top + relativeY, 2)) + 'px';
86+
menu.style.top = Math.max(event.clientY - frameBounds.top + relativeY, 2) + 'px';
8787
menu.style.opacity = '1';
8888
this.elem = menu;
8989
this.onClose = onClose;

web/styles/contextMenu.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.contextMenu{
22
display:block;
3-
position:absolute;
3+
position:fixed;
44
background-color:var(--vscode-menu-background);
55
box-shadow:0 1px 4px 1px var(--vscode-widget-shadow);
66
color:var(--vscode-menu-foreground);
77
list-style-type:none;
88
margin:0;
99
padding:4px 0;
10-
z-index:10;
10+
z-index:13;
1111
-webkit-user-select:none;
1212
user-select:none;
1313
}

0 commit comments

Comments
 (0)