Skip to content

Commit

Permalink
Fix Show Keyboard Shortcuts command (jupyterlab#15170)
Browse files Browse the repository at this point in the history
* Fix Show Keyboard Shortcuts command

* Update packages/apputils-extension/src/index.ts

Co-authored-by: Michał Krassowski <[email protected]>

* Lint

---------

Co-authored-by: Michał Krassowski <[email protected]>
  • Loading branch information
jtpio and krassowski authored Sep 29, 2023
1 parent 1692817 commit bd46c76
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/apputils-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,14 +646,11 @@ const utilityCommands: JupyterFrontEndPlugin<void> = {
'Show relevant keyboard shortcuts for the current active widget'
),
execute: args => {
const included = app.shell.currentWidget?.node.contains(
document.activeElement
);
const currentWidget = app.shell.currentWidget;
const included = currentWidget?.node.contains(document.activeElement);

if (!included) {
const currentNode =
(app.shell.currentWidget as MainAreaWidget)?.content.node ??
app.shell.currentWidget?.node;
if (!included && currentWidget instanceof MainAreaWidget) {
const currentNode = currentWidget.content.node ?? currentWidget?.node;
currentNode?.focus();
}
const options = { commands, trans };
Expand Down

0 comments on commit bd46c76

Please sign in to comment.