Skip to content

Commit 014079e

Browse files
authored
Revert "feat: improve a11y (#292)" (#293)
This reverts commit d3de52f.
1 parent 9e147ab commit 014079e

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
3838
type = 'checkbox',
3939
title,
4040
onChange,
41-
children,
4241
...inputProps
4342
} = props;
4443

4544
const inputRef = useRef<HTMLInputElement>(null);
46-
const holderRef = useRef<HTMLLabelElement>(null);
45+
const holderRef = useRef<HTMLElement>(null);
4746

4847
const [rawValue, setRawValue] = useMergedState(defaultChecked, {
4948
value: checked,
@@ -91,7 +90,7 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
9190
};
9291

9392
return (
94-
<label className={classString} title={title} style={style} ref={holderRef}>
93+
<span className={classString} title={title} style={style} ref={holderRef}>
9594
<input
9695
{...inputProps}
9796
className={`${prefixCls}-input`}
@@ -102,8 +101,7 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
102101
type={type}
103102
/>
104103
<span className={`${prefixCls}-inner`} />
105-
{children !== undefined && <span>{children}</span>}
106-
</label>
104+
</span>
107105
);
108106
});
109107

tests/__snapshots__/index.test.tsx.snap

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`rc-checkbox click checkbox 1`] = `
4-
<label
4+
<span
55
class="rc-checkbox"
66
>
77
<input
@@ -11,11 +11,11 @@ exports[`rc-checkbox click checkbox 1`] = `
1111
<span
1212
class="rc-checkbox-inner"
1313
/>
14-
</label>
14+
</span>
1515
`;
1616

1717
exports[`rc-checkbox click radio 1`] = `
18-
<label
18+
<span
1919
class="rc-checkbox rc-checkbox-checked"
2020
>
2121
<input
@@ -25,11 +25,11 @@ exports[`rc-checkbox click radio 1`] = `
2525
<span
2626
class="rc-checkbox-inner"
2727
/>
28-
</label>
28+
</span>
2929
`;
3030

3131
exports[`rc-checkbox control mode 1`] = `
32-
<label
32+
<span
3333
class="rc-checkbox rc-checkbox-checked"
3434
>
3535
<input
@@ -40,11 +40,11 @@ exports[`rc-checkbox control mode 1`] = `
4040
<span
4141
class="rc-checkbox-inner"
4242
/>
43-
</label>
43+
</span>
4444
`;
4545

4646
exports[`rc-checkbox works 1`] = `
47-
<label
47+
<span
4848
class="rc-checkbox"
4949
>
5050
<input
@@ -54,5 +54,5 @@ exports[`rc-checkbox works 1`] = `
5454
<span
5555
class="rc-checkbox-inner"
5656
/>
57-
</label>
57+
</span>
5858
`;

0 commit comments

Comments
 (0)