From f41c636db4cd04f0c1bb2f53e3e1f811ba376134 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 17 Jan 2020 13:59:14 +0100 Subject: [PATCH] Make sure contextmenu event is also forwarded when fired on the input field Since Firefox, as of patch a21ea6f496f09d0, seems to fire it on the textarea. Closes #6116 --- src/edit/CodeMirror.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/edit/CodeMirror.js b/src/edit/CodeMirror.js index 9188e1b255..3429da1efc 100644 --- a/src/edit/CodeMirror.js +++ b/src/edit/CodeMirror.js @@ -120,6 +120,9 @@ function registerEventHandlers(cm) { // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for these browsers. on(d.scroller, "contextmenu", e => onContextMenu(cm, e)) + on(d.input.getField(), "contextmenu", e => { + if (!d.scroller.contains(e.target)) onContextMenu(cm, e) + }) // Used to suppress mouse event handling when a touch happens let touchFinished, prevTouch = {end: 0}