Skip to content

Commit

Permalink
fix(theme): prevent closing local search box on key enter (#2933)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Sep 10, 2023
1 parent c6ff5c7 commit e544b41
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/client/theme-default/components/VPLocalSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,15 @@ onKeyStroke('ArrowDown', (event) => {
const router = useRouter()
onKeyStroke('Enter', () => {
onKeyStroke('Enter', (e) => {
if (e.target instanceof HTMLButtonElement && e.target.type !== 'submit')
return
if (e.target instanceof HTMLInputElement) {
e.preventDefault()
return
}
const selectedPackage = results.value[selectedIndex.value]
if (selectedPackage) {
router.go(selectedPackage.id)
Expand Down Expand Up @@ -464,6 +472,7 @@ function formMarkRegex(terms: Set<string>) {
<button
v-if="!disableDetailedView"
class="toggle-layout-button"
type="button"
:class="{ 'detailed-list': showDetailedList }"
:title="$t('modal.displayDetails')"
@click="
Expand Down

0 comments on commit e544b41

Please sign in to comment.