The theme uses the usa-input-required class to display the * and "required" text on fields that are required. However this is missing on fieldset fields. I've overridden this template and added a line to add this class if it's a required field. Unfortunately this can't be as easily done in a preprocess function, as the classes added are only defined in the template.

Issue fork uswds-3083130

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

johne created an issue. See original summary.

johne’s picture

Here's the patch.

jaydarnell’s picture

This appears to work quite nicely. Thanks John.

jdearie’s picture

I installed this patch, but still wasn't seeing the required field indicators. I had to add the code below to my global.css to get to the indicator to show. Any idea what could be preventing the indicator to show even with the patch?

.form-required::after {
    content: '';
    vertical-align: super;
    display: inline-block;
    background-image: url(/core/misc/icons/ee0000/required.svg);
    background-repeat: no-repeat;
    background-size: 6px 6px;
    width: 6px;
    height: 6px;
    margin: 0 0.3em;
    }

rymcveigh made their first commit to this issue’s fork.

rymcveigh’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
rymcveigh’s picture

I'm going to create an MR for this issue and update the codebase to use the current USWDS classes for fieldsets.

rymcveigh’s picture

Status: Active » Needs review

I created an MR for this issue and was able to move the required logic into the preprocess much like how it's done in the form_element_label.preprocess.inc file.

lkacenja’s picture

Status: Needs review » Reviewed & tested by the community

I tested this on a staging environment with the patch applied. I tried required and non-required fieldsets. All the classes seem to appear correctly. Thanks!

rymcveigh’s picture

It looks like the MR attached to this issue has been RTBTC. Is there a plan to merge this into the codebase sometime soon?

jrglasgow’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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