Skip to content

Commit

Permalink
feat: close search options when a tag is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jan 29, 2024
1 parent 18ecbf5 commit 0bb0668
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/pages/posts/navigation/search/SearchMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,17 @@
*/
const selectedTags = ref(cloneDeep(props.initialSelectedTags))
/**
* Close combobox options when a tag is selected
*/
watch(selectedTags, async () => {
comboboxButtonRef.value?.el.click()
})
const searchQuery = shallowRef('')
const comboboxButtonRef = ref<HTMLInputElement | null>(null)
// Change event
function onComboboxInputChange(event: InputEvent) {
let value = (event.target as HTMLInputElement).value
Expand Down Expand Up @@ -212,7 +221,10 @@
/>

<!-- Button -->
<HeadlessComboboxButton class="absolute inset-y-0 right-0 flex items-center rounded-r-md px-2">
<HeadlessComboboxButton
ref="comboboxButtonRef"
class="absolute inset-y-0 right-0 flex items-center rounded-r-md px-2"
>
<ChevronUpDownIcon class="h-5 w-5 text-base-content group-hover:text-base-content-hover" />
</HeadlessComboboxButton>

Expand Down

0 comments on commit 0bb0668

Please sign in to comment.