W3C Validation: required attribute not allowed on fieldset tag

Created on 2 October 2020, over 4 years ago
Updated 21 March 2024, 11 months ago

Problem/Motivation

Required fieldset tags generated for checkbox and radio button fields do not pass https://validator.w3.org/ validation. The following errors and and warnings are produced:

  1. Error: Attribute required not allowed on element fieldset at this point.
  2. Error: Element fieldset is missing required attribute role.
  3. Warning: Attribute aria-required is unnecessary for elements that have attribute required.

Steps to reproduce

  • Go to admin/structure/types/manage/article/fields
  • Click Add field.
  • Choose List (text) from the Add a new field drop down and give the field a label.
  • Save
  • Add several values to the Allowed values list.
  • Save field settings.
  • Check Required Field
  • Save settings.
  • Go to admin/structure/types/manage/article/form-display
  • Change your field from Select list to Check boxes/radio buttons
  • Save
  • Go to node/add/article
  • View Page Source and submit it to validator.w3.org

Proposed resolution

Remove aria=required and required=required from fieldsets using template_preprocess_fieldset() in core.

Remaining tasks

tbd.

User interface changes

none.

API changes

none.

Data model changes

none.

Release notes snippet

tbd.

Additional Notes:

  • This was discovered via an issue for the Apigee Edge module in github.
  • I intentionally didn't include https://www.drupal.org/project/drupal/issues/2951317 ๐Ÿ› Radios element missing "required" attribute Needs work and https://www.drupal.org/project/drupal/issues/2951317 ๐Ÿ› Radios element missing "required" attribute Needs work in the Related Issues for this task because I believe this can be completed without answering the more complicated question of what to do with the actual input markup.
  • This issue was reported and fixed in webform.
๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Formย  โ†’

Last updated 7 days ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States zakiya

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024