Problem/Motivation
The wrapper of the element email_confirm has:
<div id="edit-email" ....... data-once="states" required="required" aria-required="true">..... </div>
The problem here is that a DIV has required attribute and aria-required attribute.
This should be put on the inputs of the two email fields. But they are lacking over there:
<input autocomplete="email" data-drupal-selector="edit-email-mail-1" class="webform-email form-email" type="email" id="edit-email-mail-1" name="email[mail_1]" value="" size="60" maxlength="254" data-once="webform-disable-autosubmit" style="........
This violates:
Elements must only use supported ARIA attributes
Impact Critical
Solution suggestions
Fix all of the following:
ARIA attribute is not allowed: aria-required="true"
Tested with axe-core:4.0.9 & Accessibility Cloud lite.
This can be tested live at: https://www.politie.be/5998/nl/contact/online-aangiften/meldpunt-sportfraude
Steps to reproduce
Form with email_confirm element and a checkbox.
Make the email_confirm element only visible (or hidden) when the checkbox is unchecked or checked.
This will trigger adding state logic / html attributes to the element/.
Proposed resolution
From what I can see right now we could need to alter/adapt:
case 'form_element':
// Process #states for #wrapper_attributes.
// @see template_preprocess_form_element().
WebformFormHelper::processStates($element, '#wrapper_attributes');
break;
}
Inside of WebformCompositeFormElementTrait.php
Will update with new findings if time let's me.
Remaining tasks
Resolve the a11y issue. Move the required attributes (also the the aria-required) to the two input fields.
Issue fork webform-3566950
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liam morlandYes, the attributes should be used correctly.
@requiredand@aria-requiredbelong on form control elements. This needs to be fixed on 6.3.x and then could be backported. Using status "Active" until there is a patch.Comment #5
hai nguyen commentedCreated a merge request for this fix: https://git.drupalcode.org/project/webform/-/merge_requests/952