feat: improved tab navigation

This commit is contained in:
Cory Dransfeldt 2024-06-18 15:32:25 -07:00
parent 7943179e16
commit ccce1537fd
No known key found for this signature in database
20 changed files with 171 additions and 59 deletions

View file

@ -36,6 +36,10 @@ permalink: /search.html
renderSearchResults(results)
})
$input.addEventListener('keydown', (event) => {
if (event.key === 'Enter') event.preventDefault()
})
const getSearchResults = (query) => miniSearch.search(query, { prefix: true, fuzzy: 0.2, boost: { title: 2 } }).map(({ id }) => resultsById[id])
const renderSearchResults = (results) => {
$results.innerHTML = results.map(({ title, url }) => {
@ -48,7 +52,7 @@ permalink: /search.html
$results.classList.add('hidden')
}
}
})();
})()
</script>
<form class="search__form" action="https://duckduckgo.com" method="get">
<input class="search__form--input" placeholder="Search" type="search" name="q" autocomplete="off" autofocus>