Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 955fb6a

Browse files
committed
fix(checkbox): switch back to gen id instead of use id
Signed-off-by: Zakaria Sahmane <[email protected]>
1 parent c9251fe commit 955fb6a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/c-checkbox/src/checkbox.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
ThemingProps,
2626
SystemProps,
2727
} from "@chakra-ui/styled-system"
28-
import { SNAO, vueThemingProps, getValidChildren } from "@chakra-ui/vue-utils"
28+
import { SNAO, vueThemingProps, getValidChildren, genId } from "@chakra-ui/vue-utils"
2929
import { HTMLChakraProps } from "@chakra-ui/vue-system"
3030
import * as checkbox from "@zag-js/checkbox"
3131
import { normalizeProps, useMachine, mergeProps } from "@zag-js/vue"
@@ -179,9 +179,9 @@ export const CCheckbox = defineComponent({
179179
mergedProps as CFormControlProviderContext
180180
)
181181

182-
const id = useId(props.id)
182+
const id = genId()
183183
const [rootId, inputId, controlId, labelId] = useIds(
184-
`chakra-checkbox-${id.value}`,
184+
`chakra-checkbox-${id}`,
185185
"root",
186186
"input",
187187
"control",
@@ -221,7 +221,7 @@ export const CCheckbox = defineComponent({
221221
})
222222

223223
const context = computed<checkbox.Context>(() => ({
224-
id: id.value,
224+
id,
225225
ids: {
226226
root: rootId.value,
227227
input: inputId.value,

packages/c-checkbox/tests/__snapshots__/c-checkbox.test.ts.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ exports[`should render properly 1`] = `
99
class="chakra-checkbox chakra-1tw369l"
1010
data-part="root"
1111
data-scope="checkbox"
12-
for="input-chakra-checkbox-1"
13-
id="root-chakra-checkbox-1"
12+
for="input-chakra-checkbox-EMPTY_STRING"
13+
id="root-chakra-checkbox-EMPTY_STRING"
1414
>
1515
<input
1616
aria-invalid="false"
17-
aria-labelledby="checkbox:1:label"
17+
aria-labelledby="checkbox:EMPTY_STRING:label"
1818
class="chakra-checkbox__input"
1919
data-part="input"
2020
data-scope="checkbox"
2121
defaultchecked="false"
22-
id="input-chakra-checkbox-1"
22+
id="input-chakra-checkbox-EMPTY_STRING"
2323
style="border: 0px; height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap; word-wrap: normal;"
2424
type="checkbox"
2525
/>
@@ -28,7 +28,7 @@ exports[`should render properly 1`] = `
2828
class="chakra-checkbox__control chakra-drpdfl"
2929
data-part="control"
3030
data-scope="checkbox"
31-
id="control-chakra-checkbox-1"
31+
id="control-chakra-checkbox-EMPTY_STRING"
3232
>
3333
<svg
3434
class="chakra-1mg6af5"

0 commit comments

Comments
 (0)