Skip to content

Commit

Permalink
Fix requiring position for undetermined index (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval authored Mar 6, 2023
1 parent e3c2213 commit 6c1fe7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/widgets/src/menubar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ export class MenuBar extends Widget {
}

// Get position for the new menu >before< updating active index.
const position = this._positionForMenu(index);
const position =
index >= 0 && this._childMenu ? this._positionForMenu(index) : null;

// Before any modification, update window data.
Menu.saveWindowData();
Expand All @@ -710,7 +711,7 @@ export class MenuBar extends Widget {
this.activeIndex = index;

// Open the new menu if a menu is already open.
if (this._childMenu) {
if (position) {
this._openChildMenu(position);
}
}
Expand Down

0 comments on commit 6c1fe7c

Please sign in to comment.