Skip to content

Commit

Permalink
fix(tags-input): ignore key during composition in onKeyDown event (#…
Browse files Browse the repository at this point in the history
…805)

Co-authored-by: Segun Adebayo <[email protected]>
  • Loading branch information
orionmiz and segunadebayo authored Aug 16, 2023
1 parent db81eaa commit a698f23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-items-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/tags-input": patch
---

Ignore key during composition in `onKeyDown` event
3 changes: 3 additions & 0 deletions packages/machines/tags-input/src/tags-input.connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
send({ type: "PASTE", value })
},
onKeyDown(event) {
const evt = getNativeEvent(event)
if (evt.isComposing) return

// handle composition when used as combobox
const target = event.currentTarget as HTMLElement
const isCombobox = target.getAttribute("role") === "combobox"
Expand Down

4 comments on commit a698f23

@vercel
Copy link

@vercel vercel bot commented on a698f23 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on a698f23 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

zag-nextjs – ./examples/next-ts

zag-nextjs-chakra-ui.vercel.app
zag-nextjs-git-main-chakra-ui.vercel.app
zag-two.vercel.app

@vercel
Copy link

@vercel vercel bot commented on a698f23 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

zag-vue – ./examples/vue-ts

zag-vue-chakra-ui.vercel.app
zag-vue-git-main-chakra-ui.vercel.app
zag-vue.vercel.app

@vercel
Copy link

@vercel vercel bot commented on a698f23 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

zag-solid – ./examples/solid-ts

zag-solid.vercel.app
zag-solid-chakra-ui.vercel.app
zag-solid-git-main-chakra-ui.vercel.app

Please sign in to comment.