Skip to content

Commit

Permalink
fix(combobox): highlight values remain when items changed (#1841)
Browse files Browse the repository at this point in the history
* fix(combobox): force reset highlight when children changed

* chore: add changeset
  • Loading branch information
erm1116 authored Sep 12, 2024
1 parent 13eef3e commit e623a06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/spicy-mugs-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/combobox": patch
---

Fix issue where remaining incorrect highlight values when items changed
2 changes: 1 addition & 1 deletion packages/machines/combobox/src/combobox.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ export function machine<T extends CollectionItem>(userContext: UserDefinedContex
highlightFirstItem(ctx) {
raf(() => {
const value = ctx.collection.firstValue
set.highlightedValue(ctx, value)
set.highlightedValue(ctx, value, true)
})
},
highlightFirstItemIfNeeded(ctx) {
Expand Down

0 comments on commit e623a06

Please sign in to comment.