Reduce form element reuse

Created on 3 October 2024, 7 months ago

Problem/Motivation

This started mostly because the "Select" form element label was repeated several times in the Style Guide page. My accessibility validator flagged it over and over because it wasn't unique. I realized it was because the same subform was getting built and inserted into other elements repeatedly, namely fieldsets and details. In turn the fieldset and details were then reused as Vertical Tabs sections, making the problem even worse.

Thank you for considering this. For those of us who are going to have accessibility reviewers test the page, it would be nice if we aren't having to deal with these false-positives.

Proposed resolution

  • Move <details> from the form to the common HTML elements. Where they belong is kind of subjective. They're non-form container elements. Drupal Core's documentation says they can be used in non-form contexts, suggesting that the render element is sort of intended to be used in forms. I would prefer to see them containing basic text instead of child form elements. But that's just me. Feel free to disagree.
  • Put a couple of unique child elements in the <fieldset> rather than reusing existing elements.
  • Create unique tabs for the Vertical Tabs instead of reusing the fieldset and details.

Doing this reduces the number of validation errors on the page by about 10.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dcam

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024