Skip to content

Commit

Permalink
Fix search interactions (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Jan 15, 2024
1 parent d32e96d commit ef5491a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/scanpydoc/theme/static/scripts/rtd-sphinx-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
*/

// wire up the search key combination
addEventListener("keydown", ({ key, metaKey, ctrlKey }) => {
if (key === "k" && (metaKey || ctrlKey)) {
showSearchModal()
}
})
addEventListener(
"keydown",
({ key, metaKey, ctrlKey }) => {
if (key === "k" && (metaKey || ctrlKey)) {
if (isModalVisible()) {
removeSearchModal()
} else {
showSearchModal()
}
}
},
{ passive: true },
)

// start attempting to override the search popup and to wire up the search button
setTimeout(overrideSearch, 0)
Expand Down

0 comments on commit ef5491a

Please sign in to comment.