From d670be942e4f072dce768a14c30e72b686c44ee2 Mon Sep 17 00:00:00 2001
From: Florian Duros <florian.duros@ormaz.fr>
Date: Mon, 26 Aug 2024 14:16:33 +0200
Subject: [PATCH] Fix keyboard navigation in spotlight

---
 src/components/views/dialogs/spotlight/SpotlightDialog.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx
index 8d19e921f0..b6d8420750 100644
--- a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx
+++ b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx
@@ -703,7 +703,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
                     const event = ev as React.KeyboardEvent;
                     // We want to be able to interact with the content of the row without joining automatically a room
                     // But we want to keep the listener for keyboard action
-                    if (event.key === Key.ENTER) {
+                    // We check `event.detail` because of an unknown reason on some cases, `event.key` is undefined on an `Enter` key press
+                    if (event.key === Key.ENTER || event.key === Key.SPACE || event.detail === 0) {
                         listener(ev);
                     }
                 };
-- 
GitLab