diff --git a/src/formio/components/Checkbox.scss b/src/formio/components/Checkbox.scss index 82257c24f..37810008b 100644 --- a/src/formio/components/Checkbox.scss +++ b/src/formio/components/Checkbox.scss @@ -27,7 +27,8 @@ } } - .utrecht-form-field__label { + .utrecht-form-field__label, + .utrecht-form-description--openforms { background-color: var(--_of-utrecht-form-field-checkbox-background-color); --_of-checkbox-label-shift: calc( var(--of-utrecht-form-label-checkbox-padding-block-start) + var(--utrecht-checkbox-size) @@ -48,6 +49,14 @@ --of-utrecht-form-field-checkbox-label-margin-block-end ); } + + .utrecht-form-description--openforms { + padding-inline-start: calc( + var(--_of-checkbox-label-shift) + + var(--of-utrecht-form-label-checkbox-padding-inline-start) + ); + padding-block-end: var(--of-utrecht-form-label-radio-padding-block-end); + } } } } diff --git a/src/formio/components/Radio.stories.js b/src/formio/components/Radio.stories.js index 9c5092086..29f46c1a1 100644 --- a/src/formio/components/Radio.stories.js +++ b/src/formio/components/Radio.stories.js @@ -21,6 +21,7 @@ export default { label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', value: 'radioC', + description: 'Description optie C', }, ], }, diff --git a/src/formio/components/Selectboxes.stories.js b/src/formio/components/Selectboxes.stories.js index 8581391e3..4fadb0f66 100644 --- a/src/formio/components/Selectboxes.stories.js +++ b/src/formio/components/Selectboxes.stories.js @@ -16,6 +16,7 @@ export default { { label: 'Optie B', value: 'selectB', + description: 'Description optie B', }, { label: diff --git a/src/formio/templates/radio.ejs b/src/formio/templates/radio.ejs index 1540f045d..657dabc45 100644 --- a/src/formio/templates/radio.ejs +++ b/src/formio/templates/radio.ejs @@ -21,6 +21,15 @@ {% if (ctx.value && (ctx.value === item.value || (typeof ctx.value === 'object' && ctx.value.hasOwnProperty(item.value) && ctx.value[item.value]))) { %} checked=true {% } %} + + {% if (item.description) { %} + aria-describedby="{{ctx.id}}{{ctx.row}}-{{item.value}}-description" + {% } %} > + {% if (item.description) { %} +
+ {{ item.description }} +
+ {% } %} {% }) %} diff --git a/src/scss/components/_radio-field.scss b/src/scss/components/_radio-field.scss index d97f95fa8..f7af9d4db 100644 --- a/src/scss/components/_radio-field.scss +++ b/src/scss/components/_radio-field.scss @@ -30,6 +30,11 @@ ); } + .utrecht-form-description--openforms { + padding-inline-start: var(--of-utrecht-form-label-radio-padding-inline-start); + padding-block-end: var(--of-utrecht-form-label-radio-padding-block-end); + } + &:focus-within { outline: var(--of-utrecht-form-label-radio-focus-within-outline); }