Skip to content

Commit

Permalink
added keyboard shortcut to focus search
Browse files Browse the repository at this point in the history
>
>
Co-authored-by: Melissa Van Bussel <[email protected]>
  • Loading branch information
edavidaja committed Aug 15, 2024
1 parent be2fd26 commit 694cc40
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inst/BS5/assets/pkgdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,11 @@ async function searchFuse(query, callback) {
});
});
})(window.jQuery || window.$)

document.addEventListener('keydown', function(event) {
// Check if the pressed key is '/'
if (event.key === '/') {
event.preventDefault(); // Prevent any default action associated with the '/' key
document.getElementById('search-input').focus(); // Set focus to the search input
}
});

0 comments on commit 694cc40

Please sign in to comment.