diff options
author | Florrie <towerofnix@gmail.com> | 2019-09-17 13:23:19 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-09-17 13:23:19 -0300 |
commit | 376d169962e8080651b93adc9405901d8f601b4c (patch) | |
tree | 9f21de9406f06d2f003d016904af7dc9c084c46a /ui.js | |
parent | 200a069023041d194b2c1df54577f5b455aa89c9 (diff) |
Fix select-el keys not working w/ context menus
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui.js b/ui.js index b1eb7c4..a3860e9 100644 --- a/ui.js +++ b/ui.js @@ -3071,7 +3071,19 @@ class ContextMenu extends FocusElement { } if (this.visible) { + const newlySelected = this.root.selectedElement this.close() + + // Bad hack: if the menubar is the selected thing, directly select it + // (hence setting its previously selected element to whatever we just + // restored the selection to as the context menu). + const menubar = newlySelected.directAncestors.find( + el => el instanceof Menubar) + if (menubar) { + menubar.select() + } else { + this.selectedBefore.root.select(newlySelected) + } } } |