Skip to content

Commit 694cc40

Browse files
committed
added keyboard shortcut to focus search
> > Co-authored-by: Melissa Van Bussel <[email protected]>
1 parent be2fd26 commit 694cc40

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

inst/BS5/assets/pkgdown.js

+8
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,11 @@ async function searchFuse(query, callback) {
152152
});
153153
});
154154
})(window.jQuery || window.$)
155+
156+
document.addEventListener('keydown', function(event) {
157+
// Check if the pressed key is '/'
158+
if (event.key === '/') {
159+
event.preventDefault(); // Prevent any default action associated with the '/' key
160+
document.getElementById('search-input').focus(); // Set focus to the search input
161+
}
162+
});

0 commit comments

Comments
 (0)