Skip to content

Commit

Permalink
fix: disable search box auto open, close #99
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 8, 2022
1 parent 041453d commit eb148aa
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions .vitepress/theme/components/AlgoliaSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,8 @@ const { theme, site } = useData()
onMounted(() => {
initialize(theme.value.algolia)
setTimeout(poll, 16)
})
function poll() {
// programmatically open the search box after initialize
const e = new Event('keydown') as any
e.key = 'k'
e.metaKey = true
window.dispatchEvent(e)
setTimeout(() => {
if (!document.querySelector('.DocSearch-Modal')) {
poll()
}
}, 16)
}
// @ts-expect-error
const docsearch$ = docsearch.default ?? docsearch
type DocSearchProps = Parameters<typeof docsearch$>[0]
Expand Down

0 comments on commit eb148aa

Please sign in to comment.