Skip to content

Commit adb4ad3

Browse files
committed
Fix issue in IE where the context menu hack might stay visible
Because JS seems to be frozen entirely while the context menu is open, the next open might happen before the timeout was able to fire. This forces the previous context menu kludge to be cleared before starting a new one.
1 parent 9018db9 commit adb4ad3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/input/TextareaInput.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ export default class TextareaInput {
264264

265265
onContextMenu(e) {
266266
let input = this, cm = input.cm, display = cm.display, te = input.textarea
267+
if (input.contextMenuPending) input.contextMenuPending()
267268
let pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop
268269
if (!pos || presto) return // Opera is difficult.
269270

@@ -287,7 +288,7 @@ export default class TextareaInput {
287288
display.input.reset()
288289
// Adds "Select all" to context menu in FF
289290
if (!cm.somethingSelected()) te.value = input.prevInput = " "
290-
input.contextMenuPending = true
291+
input.contextMenuPending = rehide
291292
display.selForContextMenu = cm.doc.sel
292293
clearTimeout(display.detectingSelectAll)
293294

@@ -308,6 +309,7 @@ export default class TextareaInput {
308309
}
309310
}
310311
function rehide() {
312+
if (input.contextMenuPending != rehide) return
311313
input.contextMenuPending = false
312314
input.wrapper.style.cssText = oldWrapperCSS
313315
te.style.cssText = oldCSS

0 commit comments

Comments
 (0)