Skip to content

Commit fffca04

Browse files
committed
fix(command): add useForwardListeners for improved event handling in ListboxRoot
1 parent 0fef9f4 commit fffca04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/command/command.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { computed } from 'vue';
33
import type { ShallowRef } from 'vue';
44
import { useFuse } from '@vueuse/integrations/useFuse';
55
import { ListboxContent, ListboxFilter, ListboxRoot, provideListboxThemeContext } from '@soybeanjs/headless';
6-
import { useControllableState, useOmitProps, usePickProps } from '@soybeanjs/headless/composables';
6+
import { useControllableState, useForwardListeners, useOmitProps, usePickProps } from '@soybeanjs/headless/composables';
77
import { defu } from 'defu';
88
import { mergeSlotVariants } from '@/theme';
99
import { commandVariants } from '@/variants/command';
@@ -39,6 +39,8 @@ const forwardedProps = useOmitProps(props, [
3939
'emptyLabel'
4040
]);
4141
42+
const listeners = useForwardListeners(emit);
43+
4244
const forwardedOptionsProps = usePickProps(props, [
4345
'itemProps',
4446
'itemLabelProps',
@@ -105,7 +107,7 @@ provideCommandExtraThemeContext({
105107
</script>
106108

107109
<template>
108-
<ListboxRoot v-bind="forwardedProps" @update:model-value="emit('update:modelValue', $event)">
110+
<ListboxRoot v-bind="forwardedProps" v-on="listeners">
109111
<ListboxFilter v-bind="inputProps" v-model="searchTerm" autofocus>
110112
<template #leading>
111113
<slot name="input-leading">

0 commit comments

Comments
 (0)