Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For accessibility purposes, each webform should contain a message at the top stating: (*) indicates that a field is required. Asterisks currently appear after every required field in a form, but there is no message at the top of the page informing non-sighted users what the asterisk means.
Would it be possible to also have this enabled out of the box?
Comments
Comment #1
DanChadwick CreditAttribution: DanChadwick commentedHow is webform different from core forms?
Comment #2
Liam MorlandIf you want to override the required marker on your own site, you can implement theme_form_required_marker().
Comment #3
DanChadwick CreditAttribution: DanChadwick commentedAnswered by #2, I think.
Comment #4
Liam MorlandI think it would be reasonable to have a single notice at the top explaining what the asterisk means. The form API could check the form for the presence of required fields and add that the notice if there is more than one. If there is just one, the notice should be with the field.
However, something like this would best be done in Drupal core so that it would work with all forms, not just Webform. There is likely a hook that anyone could use to do this on their own site.
Comment #5
DSheffler CreditAttribution: DSheffler commentedComment #6
Liam MorlandComment #7
mgifford@Liam Morland do you want to open a new issue in D8 for a "single notice at the top explaining what the asterisk means"?
Comment #8
Liam MorlandWhile I think it would be reasonable to do it, I don't think it is necessary. Most people know what a red asterisk means and if they don't, the abbr title is there and they will encounter the validation message if they miss a component. So, anyone that doesn't know what the red asterisk means soon will.
Comment #9
DSheffler CreditAttribution: DSheffler commented@Liam Morland, is that the case for screen readers? If you go with the strictest sense of 508 compliance, the message should be there.
Comment #10
Liam MorlandIn D8, the asterisk is added by CSS. Screen readers get the HTML5 "required" attribute plus @aria-required (I don't see the point in having both). See #2121775: Make the markup associated with the required star on field items silent.
Comment #11
Liam MorlandComment #12
mgiffordRight.. Good point.