Skip to content

Commit

Permalink
Fix scrolling with keyboard (jenkinsci#10054)
Browse files Browse the repository at this point in the history
* Adapt keyboard.js to handle undefined as well as null

* Adjust keyboard priority
  • Loading branch information
timja authored Dec 14, 2024
1 parent 7020e80 commit db744cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/js/components/command-palette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ function init() {
searchResultsContainer,
() => searchResults.querySelectorAll("a"),
hoverClass,
() => {},
() => commandPalette.open,
);

// Events
Expand Down
2 changes: 1 addition & 1 deletion src/main/js/util/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function makeKeyboardNavigable(
}

function scrollAndSelect(selectedItem, selectedClass, items) {
if (selectedItem !== null) {
if (selectedItem) {
if (!isInViewport(selectedItem)) {
selectedItem.scrollIntoView(false);
}
Expand Down

0 comments on commit db744cc

Please sign in to comment.