adobe / adobe/aem-core-forms-components
Make checkedValue and uncheckedValue mandatory for Checkbox component
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 62
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 8
Description
## Problem
The `checkbox` component definition marks `checkedValue` and `uncheckedValue` as `required: false` with no default value. This means a checkbox can be authored and validated successfully without specifying what value it submits when checked or unchecked.
When neither property is set, AEM Core Components fall back to submitting the HTML default `"on"` when the checkbox is ticked. This is silent and non-obvious — the form validates, the field renders, and `required: true` guards against skipping it, but the submitted *value* is undefined/unpredictable unless the author explicitly sets `checkedValue`.
## Impact
- Form authors can create checkbox fields that pass schema validation but submit an implementation-specific default (`"on"`) instead of a meaningful domain value (e.g. `"true"`, `"agreed"`).
- Back-end submission processors that check for a specific string value will silently miss, with no authoring-time warning.
- Tooling that generates component payloads from a spec (e.g. AI-assisted authoring) has no signal to prompt for these values.
## Proposed Solution
Mark `checkedValue` as `required: true` in the checkbox component definition. Optionally also require `uncheckedValue` when `enableUncheckedValue` is `true`.
This would cause `validate-patch` and the AEM dialog to surface missing values at authoring time rather than silently falling back to `"on"`.
## Component
`core/fd/components/form/checkbox/v1/checkbox`
Definition field: `./checkedValue` — currently `required: false`, no `default`
Contributor guide
Assessment
This issue has not been assessed yet.