diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index d3fae9fdc..86ebd0b9a 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -13,6 +13,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Fixed a bug where updating a menu item's label wouldn't update the display label in `` [#729](https://github.com/shoelace-style/shoelace/issues/729) - Fixed a bug where the FormData event polyfill was causing issues with older browsers [#747](https://github.com/shoelace-style/shoelace/issues/747) - Fixed a bug that caused a console error when setting `value` to `null` or `undefined` in ``, ``, and `` [#751](https://github.com/shoelace-style/shoelace/pull/751) +- Fixed a bug that caused `` and `` controls without a `value` to submit as `null` instead of `on` like native inputs [#744](https://github.com/shoelace-style/shoelace/issues/744) - Improved behavior of clearable and password toggle buttons in `` and `` [#745](https://github.com/shoelace-style/shoelace/issues/745) - Improved performance of `` by caching menu items instead of traversing for them each time - Revert form submit logic [#718](https://github.com/shoelace-style/shoelace/issues/718) diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 0a7f68fef..b48f85797 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -32,7 +32,7 @@ export default class SlCheckbox extends LitElement { // @ts-expect-error -- Controller is currently unused private readonly formSubmitController = new FormSubmitController(this, { - value: (control: SlCheckbox) => (control.checked ? control.value : undefined) + value: (control: SlCheckbox) => (control.checked ? control.value : 'on') }); @state() private hasFocus = false; diff --git a/src/components/radio/radio.ts b/src/components/radio/radio.ts index 26eecd38e..86740b599 100644 --- a/src/components/radio/radio.ts +++ b/src/components/radio/radio.ts @@ -30,7 +30,7 @@ export default class SlRadio extends LitElement { @query('.radio__input') input: HTMLInputElement; protected readonly formSubmitController = new FormSubmitController(this, { - value: (control: HTMLInputElement) => (control.checked ? control.value : undefined) + value: (control: HTMLInputElement) => (control.checked ? control.value : 'on') }); @state() protected hasFocus = false;