From 376d169962e8080651b93adc9405901d8f601b4c Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 17 Sep 2019 13:23:19 -0300 Subject: Fix select-el keys not working w/ context menus --- ui.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ui.js') 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) + } } } -- cgit 1.3.0-6-gf8a5