From 694cc40304c814c7b03c9edb887e15ec8f50bcdc Mon Sep 17 00:00:00 2001 From: edavidaja Date: Thu, 15 Aug 2024 14:59:00 -0700 Subject: [PATCH] added keyboard shortcut to focus search > > Co-authored-by: Melissa Van Bussel --- inst/BS5/assets/pkgdown.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inst/BS5/assets/pkgdown.js b/inst/BS5/assets/pkgdown.js index 9757bf9ef..1a99c65f5 100644 --- a/inst/BS5/assets/pkgdown.js +++ b/inst/BS5/assets/pkgdown.js @@ -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 + } +});