Skip to content

Commit 61860ad

Browse files
Suyog241005heath-freenomedependabot[bot]
authored
fix: prevent duplicate checkbox description rendering across themes (#4825)
* fix: prevent duplicate checkbox description rendering across themes (#4742) * Update packages/core/src/components/widgets/CheckboxWidget.tsx Co-authored-by: Heath C <[email protected]> * Update packages/mui/src/FieldTemplate/FieldTemplate.tsx Co-authored-by: Heath C <[email protected]> * test: add test cases for checkbox, radio, and select widgets with descriptions * Update packages/snapshot-tests/src/formTests.tsx Co-authored-by: Heath C <[email protected]> * Update packages/snapshot-tests/src/formTests.tsx Co-authored-by: Heath C <[email protected]> * Update packages/snapshot-tests/src/formTests.tsx Co-authored-by: Heath C <[email protected]> * Update test snapshots * chore(deps): bump actions/download-artifact from 5 to 6 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v5...v6) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore(deps): bump github/codeql-action from 3 to 4 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore(deps): bump actions/upload-artifact from 4 to 5 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v5) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore(deps): bump actions/setup-node from 5 to 6 Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v5...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore(deps-dev): bump mocha from 10.8.2 to 11.7.4 (#4834) Bumps [mocha](https://github.com/mochajs/mocha) from 10.8.2 to 11.7.4. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md) - [Commits](mochajs/mocha@v10.8.2...v11.7.4) --- updated-dependencies: - dependency-name: mocha dependency-version: 11.7.4 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Heath C <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Heath C <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent f626123 commit 61860ad

File tree

24 files changed

+15099
-8220
lines changed

24 files changed

+15099
-8220
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,51 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
1515
should change the heading of the (upcoming) version to include a major version bump.
1616
1717
-->
18+
# 6.0.2
19+
20+
## @rjsf/shadcn
21+
22+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
23+
24+
## @rjsf/semantic-ui
25+
26+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
27+
28+
## @rjsf/react-bootstrap
29+
30+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
31+
32+
## @rjsf/primereact
33+
34+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
35+
36+
## @rjsf/mui
37+
38+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
39+
40+
## @rjsf/mantine
41+
42+
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
43+
44+
## @rjsf/fluentui-rc
45+
46+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
47+
48+
## @rjsf/antd
49+
50+
- Updated `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
51+
52+
53+
## @rjsf/chakra-ui
54+
55+
- Updated `CheckboxWidget` to handle label and description rendering consistently, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
56+
57+
## @rjsf/core
58+
59+
- Fixed duplicate label and description rendering in `CheckboxWidget` by conditionally rendering them based on widget type
60+
- Updated `CheckboxWidget` to handle label and description rendering consistently
61+
- Modified `FieldTemplate` to skip label and description rendering for checkbox widgets, fixing ([#4742](https://github.com/rjsf-team/react-jsonschema-form/issues/4742))
62+
1863
# 6.0.1
1964

2065
## Dev / docs / playground

packages/antd/src/templates/FieldTemplate/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function FieldTemplate<
5656
} = formContext as GenericObjectType;
5757

5858
const uiOptions = getUiOptions<T, S, F>(uiSchema);
59+
5960
const WrapIfAdditionalTemplate = getTemplate<'WrapIfAdditionalTemplate', T, S, F>(
6061
'WrapIfAdditionalTemplate',
6162
registry,
@@ -79,7 +80,7 @@ export default function FieldTemplate<
7980
descriptionProps.extra = descriptionNode;
8081
break;
8182
}
82-
83+
const isCheckbox = uiOptions.widget === 'checkbox';
8384
return (
8485
<WrapIfAdditionalTemplate
8586
classNames={classNames}
@@ -101,7 +102,7 @@ export default function FieldTemplate<
101102
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
102103
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
103104
htmlFor={id}
104-
label={displayLabel && label}
105+
label={displayLabel && !isCheckbox && label}
105106
labelCol={labelCol}
106107
required={required}
107108
style={wrapperStyle}

0 commit comments

Comments
 (0)