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.

Issue fork styleguide-3478625

Command icon 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

dcam created an issue. See original summary.

dcam’s picture

Status: Active » Needs review

  • dcam committed db0b3588 on 2.x
    Issue #3478625 by dcam: Reduce form element reuse
    
dcam’s picture

Status: Needs review » Fixed

dcam changed the visibility of the branch 3478625-form-element-reuse to hidden.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.