Skip to content

Commit a406fd6

Browse files
OneQuidmjbvz
authored andcommitted
Fixes webview responding shortcuts twice on linux (microsoft#84967)
1 parent a56c48e commit a406fd6

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/vs/workbench/contrib/webview/browser/baseWebviewElement.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { URI } from 'vs/base/common/uri';
1414
import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewWorkbenchService';
1515
import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/common/themeing';
1616
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
17+
import { isLinux } from 'vs/base/common/platform';
1718

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

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

132136
this.style();
133137
this._register(webviewThemeDataProvider.onThemeDataChanged(this.style, this));

0 commit comments

Comments
 (0)