From db744ccc2864e76f7ca6a950369ff2f96f76a1b2 Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Sat, 14 Dec 2024 11:46:00 +0000 Subject: [PATCH] Fix scrolling with keyboard (#10054) * Adapt keyboard.js to handle undefined as well as null * Adjust keyboard priority --- src/main/js/components/command-palette/index.js | 2 ++ src/main/js/util/keyboard.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/js/components/command-palette/index.js b/src/main/js/components/command-palette/index.js index 5ece1106aed0..7c8041b50007 100644 --- a/src/main/js/components/command-palette/index.js +++ b/src/main/js/components/command-palette/index.js @@ -32,6 +32,8 @@ function init() { searchResultsContainer, () => searchResults.querySelectorAll("a"), hoverClass, + () => {}, + () => commandPalette.open, ); // Events diff --git a/src/main/js/util/keyboard.js b/src/main/js/util/keyboard.js index 88d677530416..11c414b6a5da 100644 --- a/src/main/js/util/keyboard.js +++ b/src/main/js/util/keyboard.js @@ -81,7 +81,7 @@ export default function makeKeyboardNavigable( } function scrollAndSelect(selectedItem, selectedClass, items) { - if (selectedItem !== null) { + if (selectedItem) { if (!isInViewport(selectedItem)) { selectedItem.scrollIntoView(false); }