From fa17eee93e43e2a06565045557e01a3687fb2505 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 1 Oct 2024 08:51:21 -0400
Subject: fixed contextmenu issue with nothing selected.

---
 src/client/views/ContextMenu.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/client/views/ContextMenu.tsx')

diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx
index 5edb5fc0d..399e8a238 100644
--- a/src/client/views/ContextMenu.tsx
+++ b/src/client/views/ContextMenu.tsx
@@ -252,7 +252,7 @@ export class ContextMenu extends ObservableReactComponent<{ noexpand?: boolean }
                 this._selectedIndex--;
             }
             e.preventDefault();
-        } else if (e.key === 'Enter' || e.key === 'Tab') {
+        } else if ((e.key === 'Enter' || e.key === 'Tab') && this._selectedIndex >= 0) {
             const item = this.flatItems[this._selectedIndex];
             if (item.event) {
                 item.event({ x: this.pageX, y: this.pageY });
-- 
cgit v1.2.3-70-g09d2

