Skip to content

Commit 23bf36e

Browse files
committed
fix: rating group
1 parent f988feb commit 23bf36e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/large-rings-take.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zag-js/rating-group": patch
3+
---
4+
5+
Fix issue where rating group label places focus incorrectly

packages/machines/rating-group/src/rating-group.connect.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function connect<T extends PropTypes>(
7777
if (event.defaultPrevented) return
7878
if (!interactive) return
7979
event.preventDefault()
80-
const radioEl = dom.getRadioEl(scope, 1)
80+
const radioEl = dom.getRadioEl(scope, Math.max(1, context.get("value")))
8181
radioEl?.focus({ preventScroll: true })
8282
},
8383
})

0 commit comments

Comments
 (0)