Unchecked checkbox for a boolean SDC prop initializes as checked in the component inputs form
### Overview In the component inputs form, a boolean SDC prop rendered as a checkbox is initialized to *checked* even when its stored value is `false`. Confirmed on Canvas 1.7.1; the code is unchanged on `1.x`. The cause is in `getCurrentValueFromProps()` (`ui/src/components/form/react-hook-form/utils/index.ts`). For checkboxes, none of the early branches match a typical unchecked Drupal checkbox render array, so the function falls through to: - `props.value` / `props.attributes.value` — but a checkbox's `value` attribute is its **return value when checked** (usually `"1"`), not its state. Drupal's checkbox template always renders `value="1"`, checked or not. - `props.element['#default_value']` — also truthy in some render arrays regardless of checked state. So an unchecked checkbox reports `"1"` as its current value, react-hook-form treats that as truthy, and the checkbox renders checked. Saving the form then flips the boolean prop to `true` without the editor ever touching it. ### Steps to reproduce 1. Create an SDC with a boolean prop (`type: boolean`, default/stored value `false`) that Drupal renders as a checkbox in the component inputs form. 2. Place the component on a canvas page and leave the checkbox unchecked (prop value `false`). 3. Reopen the component's inputs form in the editor. **Expected:** the checkbox is unchecked, matching the stored `false` value. **Actual:** the checkbox is checked; interacting with the form persists `true` for a prop the editor never enabled. ### Proposed resolution In `getCurrentValueFromProps()`, handle `attributes.type === 'checkbox'` explicitly before the generic value fallbacks: derive the boolean state from `element['#checked']` (falling back to `attributes.checked`) and never use the `value` attribute as the current value. Includes vitest coverage for unchecked (with and without `#checked` present), checked, `attributes.checked`, and the non-checkbox passthrough. ### Related issues None found for this symptom in the queue.
issue