From 5d4ff13f165df4785e1901ac49f82859b3073873 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Fri, 23 Feb 2018 10:32:13 -0800 Subject: [PATCH] Fix monaco-editor#643. Firefox loses focus on iframe. --- src/vs/editor/browser/controller/textAreaInput.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vs/editor/browser/controller/textAreaInput.ts b/src/vs/editor/browser/controller/textAreaInput.ts index 97926f7e12a..c344b8a05c0 100644 --- a/src/vs/editor/browser/controller/textAreaInput.ts +++ b/src/vs/editor/browser/controller/textAreaInput.ts @@ -558,6 +558,10 @@ class TextAreaWrapper extends Disposable implements ITextAreaWrapper { if (currentIsFocused && currentSelectionStart === selectionStart && currentSelectionEnd === selectionEnd) { // No change + // Firefox iframe bug https://github.com/Microsoft/monaco-editor/issues/643#issuecomment-367871377 + if (browser.isFirefox && window.parent !== window) { + textArea.focus(); + } return; } @@ -567,6 +571,9 @@ class TextAreaWrapper extends Disposable implements ITextAreaWrapper { // No need to focus, only need to change the selection range this.setIgnoreSelectionChangeTime('setSelectionRange'); textArea.setSelectionRange(selectionStart, selectionEnd); + if (browser.isFirefox && window.parent !== window) { + textArea.focus(); + } return; }