Skip to content

Commit

Permalink
Fix menu shortcuts not working after a webview is shown (#154648)
Browse files Browse the repository at this point in the history
Release notes, markdown preview, etc. use a web view. The web view uses `WindowIgnoreMenuShortcutsManager`/`allowMenuShortcuts` to disable menu shortcuts.
However, `WindowIgnoreMenuShortcutsManager.didBlur` isn't being called when the editor is closed, so the menu shortcuts stay disabled.

This seems to be a side effect of the fix for #82670.

This does not solve using Cmd+M or Cmd+H while focused on a web view.  I looked into detecting those keys and enabling menu shortcuts, but it seems like MacOS still won't detect them if you enable menu shortcuts after the key stroke is pressed but before the event is finished processing.
  • Loading branch information
ssigwart authored and andreamah committed Jul 14, 2022
1 parent 308a1fe commit 3c840f6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export class ElectronWebviewElement extends WebviewElement {
}
}

override dispose(): void {
// Make sure keyboard handler knows it closed (#71800)
this._webviewKeyboardHandler.didBlur();

super.dispose();
}

protected override webviewContentEndpoint(iframeId: string): string {
return `${Schemas.vscodeWebview}://${iframeId}`;
}
Expand Down

0 comments on commit 3c840f6

Please sign in to comment.