From 3667b77fe92e2125fa8e3613d44fb09b15f23cc4 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Tue, 26 May 2020 21:53:11 +0300 Subject: [PATCH] IDEA-241623 Shortcuts and input stop working in IDEA after creating markdown file GitOrigin-RevId: 9eb1c0a0b24d267e14b3714dac389074796696ce --- .../src/com/intellij/ui/jcef/JBCefBrowser.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java index b6cdab682d5c..d57ced028b61 100644 --- a/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java +++ b/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowser.java @@ -102,7 +102,19 @@ public class JBCefBrowser implements JBCefDisposable { myCefClient = client; myIsDefaultClient = isDefaultClient; - myComponent = new JPanel(new BorderLayout()); + myComponent = SystemInfoRt.isWindows ? + new JPanel(new BorderLayout()) { + @Override + public void removeNotify() { + if (myCefBrowser.getUIComponent().hasFocus()) { + // pass focus before removal + myCefBrowser.setFocus(false); + } + super.removeNotify(); + } + } : + new JPanel(new BorderLayout()); + myComponent.setBackground(JBColor.background()); myCefBrowser = cefBrowser != null ? @@ -136,6 +148,9 @@ public class JBCefBrowser implements JBCefDisposable { @Override public boolean onSetFocus(CefBrowser browser, FocusSource source) { if (source == FocusSource.FOCUS_SOURCE_NAVIGATION) { + if (SystemInfoRt.isWindows) { + myCefBrowser.setFocus(false); + } return true; // suppress focusing the browser on navigation events } if (SystemInfoRt.isLinux) {