Skip to content

Commit

Permalink
Fixes webview responding shortcuts twice on linux (#84967)
Browse files Browse the repository at this point in the history
  • Loading branch information
OneQuid authored and mjbvz committed Nov 18, 2019
1 parent a56c48e commit a406fd6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/vs/workbench/contrib/webview/browser/baseWebviewElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { URI } from 'vs/base/common/uri';
import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewWorkbenchService';
import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/common/themeing';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { isLinux } from 'vs/base/common/platform';

export const enum WebviewMessageChannels {
onmessage = 'onmessage',
Expand Down Expand Up @@ -122,12 +123,15 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
this.handleFocusChange(false);
}));

this._register(this.on('did-keydown', (data: KeyboardEvent) => {
// Electron: workaround for https://github.com/electron/electron/issues/14258
// We have to detect keyboard events in the <webview> and dispatch them to our
// keybinding service because these events do not bubble to the parent window anymore.
this.handleKeyDown(data);
}));
if (!isLinux) {
// Fixes #82670 webview responding shortcuts twice on linux.
this._register(this.on('did-keydown', (data: KeyboardEvent) => {
// Electron: workaround for https://github.com/electron/electron/issues/14258
// We have to detect keyboard events in the <webview> and dispatch them to our
// keybinding service because these events do not bubble to the parent window anymore.
this.handleKeyDown(data);
}));
}

this.style();
this._register(webviewThemeDataProvider.onThemeDataChanged(this.style, this));
Expand Down

0 comments on commit a406fd6

Please sign in to comment.