Skip to content

Commit

Permalink
[#524] Add aria-labelledby only when there is a suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Oct 31, 2023
1 parent 5bae7cc commit af510ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/formio/templates/label.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<label
class="utrecht-form-label {{ctx.label.className}} {% if (ctx.component.validate.required && ctx.requiredFieldsWithAsterisk) { %}utrecht-form-label--openforms-required{% } %}"
for="{{ctx.instance.id}}-{{ctx.component.key}}"
id="label-{{ctx.instance.id}}-{{ctx.component.key}}"
{% if (ctx.component.suffix) { %}
id="label-{{ctx.instance.id}}-{{ctx.component.key}}"
{% } %}
>
{{ ctx.t(ctx.component.label, { _userInput: true }) }}
{% if (!ctx.component.validate.required && !ctx.requiredFieldsWithAsterisk) { %}
Expand Down
4 changes: 3 additions & 1 deletion src/formio/templates/text.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
{{attr}}="{{ctx.input.attr[attr]}}"
{% } %}
id="{{ctx.instance.id}}-{{ctx.component.key}}"
aria-labelledby="label-{{ctx.instance.id}}-{{ctx.component.key}} {{ctx.instance.id}}-{{ctx.component.key}} suffix-{{ctx.instance.id}}-{{ctx.component.key}}"
{% if (ctx.suffix) { %}
aria-labelledby="label-{{ctx.instance.id}}-{{ctx.component.key}} {{ctx.instance.id}}-{{ctx.component.key}} suffix-{{ctx.instance.id}}-{{ctx.component.key}}"
{% } %}
>{{ctx.input.content}}</{{ctx.input.type}}>
{% if (ctx.component.showCharCount) { %}
<span class="charcount" ref="charcount"></span>
Expand Down

0 comments on commit af510ed

Please sign in to comment.