diff options
author | Florrie <towerofnix@gmail.com> | 2018-08-03 11:26:22 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-08-03 11:26:22 -0300 |
commit | 69a6a07d11bdc86b47b4c547afeedcbf8e47907a (patch) | |
tree | 315d4695a39ada4c7d99768b1e8534876af578ee | |
parent | 2144ade7eb41b9a7e90e4deff59ac5f6dfd256cc (diff) |
Don't show menu if it doesn't contain any items
-rw-r--r-- | ui.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ui.js b/ui.js index 970adbf..99039cf 100644 --- a/ui.js +++ b/ui.js @@ -1432,6 +1432,11 @@ class ContextMenu extends FocusElement { } show({x = 0, y = 0, items}) { + items = items.filter(Boolean) + if (!items.length) { + return + } + // This *should* work with a menu action which opens the menu again, // because the selected element will be restored before the menu is // opened the second time. |