From 287e33098a23f2ffda671a23c6597977413030ed Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 5 Oct 2018 22:22:44 +0300 Subject: [PATCH] allow browser context menu when possible (#7369) --- src/ui/bind_handlers.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/bind_handlers.js b/src/ui/bind_handlers.js index 1bda2fb3ed4..9ed7c877ab4 100644 --- a/src/ui/bind_handlers.js +++ b/src/ui/bind_handlers.js @@ -178,7 +178,11 @@ export default function bindHandlers(map: Map, options: {interactive: boolean, c contextMenuEvent = e; } - e.preventDefault(); + // prevent browser context menu when necessary; we don't allow it with rotation + // because we can't discern rotation gesture start from contextmenu on Mac + if (map.dragRotate.isEnabled() || map.listens('contextmenu')) { + e.preventDefault(); + } } function onWheel(e: WheelEvent) {