Skip to content

Commit

Permalink
fix(slider, range-slider): prevent thumb drag when disabled true (#864)
Browse files Browse the repository at this point in the history
Co-authored-by: Segun Adebayo <[email protected]>
  • Loading branch information
junghyeonsu and segunadebayo authored Sep 13, 2023
1 parent 1ec8547 commit be90c03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/perfect-games-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@zag-js/range-slider": patch
"@zag-js/slider": patch
---

Fix issue where slider interaction works when `disabled` is set
1 change: 1 addition & 0 deletions packages/machines/range-slider/src/range-slider.connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
tabIndex: isDisabled ? undefined : 0,
style: dom.getThumbStyle(state.context, index),
onPointerDown(event) {
if (!isInteractive) return
send({ type: "THUMB_POINTER_DOWN", index })
event.stopPropagation()
},
Expand Down
1 change: 1 addition & 0 deletions packages/machines/slider/src/slider.connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
role: "slider",
tabIndex: isDisabled ? undefined : 0,
onPointerDown(event) {
if (!isInteractive) return
send({ type: "THUMB_POINTER_DOWN" })
event.stopPropagation()
},
Expand Down

4 comments on commit be90c03

@vercel
Copy link

@vercel vercel bot commented on be90c03 Sep 13, 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 be90c03 Sep 13, 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-git-main-chakra-ui.vercel.app
zag-vue.vercel.app
zag-vue-chakra-ui.vercel.app

@vercel
Copy link

@vercel vercel bot commented on be90c03 Sep 13, 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

@vercel
Copy link

@vercel vercel bot commented on be90c03 Sep 13, 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

Please sign in to comment.