Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(combobox): highlight values remain when items changed #1841

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

erm1116
Copy link
Contributor

@erm1116 erm1116 commented Sep 11, 2024

Closes #

📝 Description

In Combobox, when we want to display something like no option when filtering by input, an unintended highilghtedValue is kept in the internal state.

This would cause an empty item (like value=‘something’, item=null) to be selected, so this issue has been fixed.

⛳️ Current behavior (updates)

CleanShot.2024-09-11.at.12.00.02.mp4

🚀 New behavior

When items changed (in other word, to change the children node), forced update the highlighted value.
This ensures that the highlight value is not an unintended,
because the value of ctx.collection.firstValue will be null if items is not present and null will be forced set.

CleanShot.2024-09-11.at.12.01.57.mp4

💣 Is this a breaking change (Yes/No):

📝 Additional Information

I thought about preventing value changes when item=null, but I thought that the problem was that the highlight was still remain so I fix like this PR.

Copy link

changeset-bot bot commented Sep 11, 2024

🦋 Changeset detected

Latest commit: ac4e204

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 75 packages
Name Type
@zag-js/combobox Patch
@zag-js/anatomy-icons Patch
@zag-js/anatomy Patch
@zag-js/core Patch
@zag-js/docs Patch
@zag-js/preact Patch
@zag-js/react Patch
@zag-js/solid Patch
@zag-js/svelte Patch
@zag-js/vue Patch
@zag-js/accordion Patch
@zag-js/avatar Patch
@zag-js/carousel Patch
@zag-js/checkbox Patch
@zag-js/clipboard Patch
@zag-js/collapsible Patch
@zag-js/color-picker Patch
@zag-js/date-picker Patch
@zag-js/dialog Patch
@zag-js/editable Patch
@zag-js/file-upload Patch
@zag-js/floating-panel Patch
@zag-js/hover-card Patch
@zag-js/menu Patch
@zag-js/number-input Patch
@zag-js/pagination Patch
@zag-js/pin-input Patch
@zag-js/popover Patch
@zag-js/presence Patch
@zag-js/progress Patch
@zag-js/qr-code Patch
@zag-js/radio-group Patch
@zag-js/rating-group Patch
@zag-js/select Patch
@zag-js/signature-pad Patch
@zag-js/slider Patch
@zag-js/splitter Patch
@zag-js/steps Patch
@zag-js/switch Patch
@zag-js/tabs Patch
@zag-js/tags-input Patch
@zag-js/time-picker Patch
@zag-js/timer Patch
@zag-js/toast Patch
@zag-js/toggle-group Patch
@zag-js/tooltip Patch
@zag-js/tour Patch
@zag-js/tree-view Patch
@zag-js/store Patch
@zag-js/types Patch
@zag-js/aria-hidden Patch
@zag-js/auto-resize Patch
@zag-js/collection Patch
@zag-js/color-utils Patch
@zag-js/utils Patch
@zag-js/date-utils Patch
@zag-js/dismissable Patch
@zag-js/dom-event Patch
@zag-js/dom-query Patch
@zag-js/element-rect Patch
@zag-js/element-size Patch
@zag-js/file-utils Patch
@zag-js/focus-visible Patch
@zag-js/form-utils Patch
@zag-js/highlight-word Patch
@zag-js/i18n-utils Patch
@zag-js/interact-outside Patch
@zag-js/live-region Patch
@zag-js/number-utils Patch
@zag-js/numeric-range Patch
@zag-js/popper Patch
@zag-js/rect-utils Patch
@zag-js/remove-scroll Patch
@zag-js/stringify-state Patch
@zag-js/text-selection Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
zag-nextjs ✅ Ready (Inspect) Visit Preview Sep 12, 2024 10:59am
zag-solid ✅ Ready (Inspect) Visit Preview Sep 12, 2024 10:59am
zag-svelte ✅ Ready (Inspect) Visit Preview Sep 12, 2024 10:59am
zag-vue ✅ Ready (Inspect) Visit Preview Sep 12, 2024 10:59am
zag-website ✅ Ready (Inspect) Visit Preview Sep 12, 2024 10:59am

Copy link

vercel bot commented Sep 11, 2024

@erm1116 is attempting to deploy a commit to the Chakra UI Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

pkg-pr-new bot commented Sep 11, 2024

Open in Stackblitz

@zag-js/anatomy

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/anatomy@1841

@zag-js/anatomy-icons

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/anatomy-icons@1841

@zag-js/docs

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/docs@1841

@zag-js/core

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/core@1841

@zag-js/store

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/store@1841

@zag-js/types

pnpm add https://pkg.pr.new/chakra-ui/zag/@zag-js/types@1841

commit: ac4e204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants