Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes webview responding shortcuts twice on linux #84967

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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