Problem/Motivation

Inline error messages for radio buttons in fieldset elements are not visible.

In form-element.html.twig (lines 96-100), errors are properly styled with Bootstrap alert classes:

<div class="form-item--error-message alert alert-danger alert-sm">
  {{ errors }}
</div>

However, in fieldset.html.twig, errors lack these classes:

<div>
  {{ errors }}
</div>

This results in inconsistent inline errors where text fields show the red error icon and alert styling, but radio button groups do not.

Steps to reproduce

Create a webform with a required radio button field inside a fieldset
Submit the form without selecting a radio option
Error message appears but lacks the in-line alert and error icon

Proposed resolution

Update fieldset.html.twig to match the error styling used in form-element.html.twig:

Add the form-item--error-message alert alert-danger alert-sm classes to the error div
Move the error block after , this positions the error message near the label text, consistent with how errors appear for other form elements.

</legend>
{% if errors %}
  <div class="form-item--error-message alert alert-danger alert-sm">
    {{ errors }}
  </div>
{% endif %}
<div class="fieldset-wrapper">

User interface changes

Before: radio button does not have in-line alert icon
before
After
after

Error messages for fieldset elements (radio buttons) will display with consistent styling matching other form elements.

CommentFileSizeAuthor
image (1).jpg25.35 KBsankeer
image.jpg44.28 KBsankeer

Comments

sankeer created an issue. See original summary.

avpaderno’s picture

Assigned: sankeer » Unassigned
avpaderno’s picture

Title: Inline errors not working for radio buttons Drupal 11 » Inline errors not working for radio buttons
Issue tags: +Drupal 11
liam morland’s picture

Status: Active » Closed (duplicate)
Related issues: +#3561249: Inline errors not working for radio buttons Drupal 11

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.