Skip to content

Commit 9757ea7

Browse files
authored
Merge pull request #337 from oasisrising/issue-336
fix: make checkbox groups accessible via fieldset & legend (issue #336)
2 parents 1b256b2 + 70fb46b commit 9757ea7

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

packages/rhf-mui/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,26 @@
33
"license": "MIT",
44
"repository": "https://github.com/dohomi/react-hook-form-mui",
55
"homepage": "https://react-hook-form-material-ui.vercel.app",
6-
"keywords": ["react", "mui", "material-ui", "react-hook-form"],
7-
"workspaces": ["apps/*", "packages/*"],
6+
"keywords": [
7+
"react",
8+
"mui",
9+
"material-ui",
10+
"react-hook-form"
11+
],
12+
"workspaces": [
13+
"apps/*",
14+
"packages/*"
15+
],
816
"name": "react-hook-form-mui",
917
"author": "Dominic Garms",
1018
"source": "src/index.ts",
1119
"main": "dist/index.js",
1220
"module": "dist/esm/index.js",
1321
"typings": "dist/index.d.ts",
14-
"files": ["dist/**", "src/**"],
22+
"files": [
23+
"dist/**",
24+
"src/**"
25+
],
1526
"exports": {
1627
"./package.json": "./package.json",
1728
".": {

packages/rhf-mui/src/CheckboxButtonGroup.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const CheckboxButtonGroup = forwardRef(function CheckboxButtonGroup<
6666
TValue = unknown,
6767
>(
6868
props: CheckboxButtonGroupProps<TFieldValues, TName, TValue>,
69-
ref: Ref<HTMLDivElement>
69+
ref: Ref<HTMLFieldSetElement>
7070
) {
7171
const {
7272
helperText,
@@ -155,8 +155,13 @@ const CheckboxButtonGroup = forwardRef(function CheckboxButtonGroup<
155155
: helperText
156156

157157
return (
158-
<FormControl error={invalid} required={required} ref={ref}>
159-
{label ? <FormLabel>{label}</FormLabel> : null}
158+
<FormControl
159+
error={invalid}
160+
required={required}
161+
ref={ref}
162+
component="fieldset"
163+
>
164+
{label ? <FormLabel component="legend">{label}</FormLabel> : null}
160165
<FormGroup row={row}>
161166
{options.map((option) => {
162167
const optionValue = propertyExists(option, valueKey)

0 commit comments

Comments
 (0)