From d827002272e9ab70631438f08d97195d47730ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Nikoli=C4=87?= Date: Mon, 6 Nov 2023 13:15:39 +0100 Subject: [PATCH] fix(combobox): autocomplete not working in vue version (#993) --- .changeset/ten-candles-pretend.md | 5 +++++ packages/machines/combobox/src/combobox.machine.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/ten-candles-pretend.md diff --git a/.changeset/ten-candles-pretend.md b/.changeset/ten-candles-pretend.md new file mode 100644 index 0000000000..40047c1ef1 --- /dev/null +++ b/.changeset/ten-candles-pretend.md @@ -0,0 +1,5 @@ +--- +"@zag-js/combobox": patch +--- + +Fix autocomplete input behavior not working in Vue version diff --git a/packages/machines/combobox/src/combobox.machine.ts b/packages/machines/combobox/src/combobox.machine.ts index a2092861d7..0c04790a4b 100644 --- a/packages/machines/combobox/src/combobox.machine.ts +++ b/packages/machines/combobox/src/combobox.machine.ts @@ -573,7 +573,9 @@ export function machine(userContext: UserDefinedContex const inputEl = dom.getInputEl(ctx) if (!ctx.autoComplete || !inputEl || !KEYDOWN_EVENT_REGEX.test(evt.type)) return const valueText = ctx.collection.valueToString(ctx.highlightedValue) - inputEl.value = valueText || ctx.inputValue + raf(() => { + inputEl.value = valueText || ctx.inputValue + }) }, setCollection(ctx, evt) { ctx.collection = evt.value