diff --git a/docs/docs/resources/changelog.md b/docs/docs/resources/changelog.md index d4eac447f..d79e67411 100644 --- a/docs/docs/resources/changelog.md +++ b/docs/docs/resources/changelog.md @@ -19,6 +19,7 @@ During the alpha period, things might break! We take breaking changes very serio - Fixed a bug that caused `` to have an undesired margin below it - Fixed a bug in `` that caused incorrect spacing of icons - Fixed a bug in the Matter theme that prevented clicks on form control labels to not focus the control +- Fixed a bug in `` that prevented radio buttons from validating - Improved native radio alignment - Improved the `.wa-cloak` utility class so all FOUCE-related solutions are 100% opt-in diff --git a/src/components/radio-group/radio-group.ts b/src/components/radio-group/radio-group.ts index 50b59a242..3eee6b8fd 100644 --- a/src/components/radio-group/radio-group.ts +++ b/src/components/radio-group/radio-group.ts @@ -228,9 +228,18 @@ export default class WaRadioGroup extends WebAwesomeFormAssociatedElement { * the first radio element. */ get validationTarget() { - return isServer - ? undefined - : this.querySelector(':is(wa-radio, wa-radio-button):not([disabled])') || undefined; + if (isServer) return undefined; + + const radio = this.querySelector(':is(wa-radio, wa-radio-button):not([disabled])'); + if (!radio) return undefined; + + // If it's a radio button, return the internal button element + if (radio.localName === 'wa-radio-button') { + return radio.input || radio; + } + + // Otherwise return the radio itself + return radio; } @watch('value')