Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/84231 #84872

Merged
merged 2 commits into from Nov 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -91,18 +91,25 @@ class NativeContextMenuService extends Disposable implements IContextMenuService
const anchor = delegate.getAnchor();
let x: number, y: number;

let zoom = webFrame.getZoomFactor();
if (dom.isHTMLElement(anchor)) {
let elementPosition = dom.getDomNodePagePosition(anchor);

x = elementPosition.left;
y = elementPosition.top + elementPosition.height;

// Shift macOS menus by a few pixels below elements
// to account for extra padding on top of native menu
// https://github.com/microsoft/vscode/issues/84231
if (isMacintosh) {
y += 4 / zoom;
}
} else {
const pos: { x: number; y: number; } = anchor;
x = pos.x + 1; /* prevent first item from being selected automatically under mouse */
y = pos.y;
}

let zoom = webFrame.getZoomFactor();
x *= zoom;
y *= zoom;

Expand Down