Problem/Motivation

The work here builds heavily on the discussion and work in #2848507: Indicate that grouping elements have child element errors for ux and a11y, so contributors to that issue should get credit in this one if they don't there.

Child elements in grouping elements like details and vertical tabs are invisible to the user when the grouping element is closed or not-active, respectively.

To improve the user experience and accessibility we should indicate when there are errors 'inside'.
Currently it is hard for the user to find the actual problematic field when the (child) field itself is invisible.

The forms sidebar has a similar problem: #3619387: Indicate on forms sidebar toggle button that sidebar has child element errors.

Steps to reproduce

  1. In settings.php, set $settings['extension_discovery_scan_tests'] = TRUE.
  2. Enable the core form_test module (drush en -y form_test).
  3. Install the article test recipe (drush recipe core/tests/fixtures/recipes/article_content_type) or create an Article content type.
  4. If necessary, set both the default and admin theme to Default Admin. Should not be necessary with this MR.
    (drush cset -y system.theme default default_admin && drush cset -y system.theme admin default_admin).
  5. For "standard" details elements:
    1. Go to /form_test/details-contains-required-fields.
    2. Click the Submit button.
    3. Close one of the details elements for comparison.
  6. For "accordion" style details elements on the node edit form:
    1. Go to /node/add/article.
    2. If the form sidebar on the right is closed, click the toggle button to open it.
    3. Enter a value without a beginning slash in the URL alias field.
    4. Click the Save button.
      This should cause a validation error: "The alias path has to start with a slash".
    5. Open the sidebar to see the invalid URL alias field.
  7. For vertical tabs:
    1. Widen your viewport to at least 650px.
    2. Go to /admin/config/people/accounts.
    3. Within one or more tabs for the Emails configuration at the bottom of the form, remove the value for the required Subject field.
    4. Click the Save button.
    5. Click a tab which does not have an error to activate it.

For RTL, either:

  • manually change the dir attribute on the html tag to rtl in the browser inspector / devtools, OR
    1. Enable the Locale module (drush en -y locale).
    2. Add Hebrew as a language (/admin/config/regional/language/add).
    3. Repeat the above steps on the Hebrew version of the pages.

Proposed resolution

Based on discussion and work in #2848507: Indicate that grouping elements have child element errors for ux and a11y, and UX review of this MR:

  1. Add a thick red solid border on one side of the grouping items that contain child errors.
  2. Border width:
    var(--vertical-tabs-menu-link--active-border-size) + 2px, so that it is distinguishable from var(--vertical-tabs-menu-link--active-border-size).
  3. Border position:
    Logical inline start of details element or vertical tab "menu item".
  4. Border radius:
    Match the radius of the element to which the border is applied.
  5. Add the error icon from the page-top error block to grouping elements.
  6. Icon position:
    • Vertical: Vertically-centered with the first line of the element's visible label.
    • Horizontal: close to the logical inline end of the element's visible label.
  7. Use red text color for the element's visible label.
  8. Details elements:
    Surround the entire details element with a 1px solid red border.
  9. Use the input error color for the red border / red text (var(--input--error-color)).
  10. Vertical tabs:
    Use the input border color for the border of the active tab to so that it's clear when a tab with errors is also active.
  11. Append visually-hidden " (child error)" to the element's visible label.
  12. Add the attribute data-child-error-count to the details element.
    Because vertical tabs are progressively-enhanced details elements, the attribute will exist on the corresponding details element but not on the vertical tabs menu item (the li element).
    The value of the attribute should be an integer corresponding to the number of invalid children.
  13. For the icon in forced-colors mode, use the mask-image property and canvasText background color.
    The UX team members and @mgifford brought up various forced-colors problems with vertical tabs, but they're out of scope. They were approved by the UX team and @mgifford to be followups.
    KentR made a note in #3081500-76: Accessibility bugs with vertical tabs.

Remaining tasks

  1. Adapt work from #2848507: Indicate that grouping elements have child element errors for ux and a11y to Default Admin.
  2. Create merge request.
  3. Usability review.
  4. Forced colors mode for icon.
  5. Fix details error border position for RTL.
  6. Manually test LTR, RTL, forced colors, and presence of hidden text for the following:
    1. Standard style details.
    2. Accordion style details (such as in advanced sidebar on node edit form).
    3. Vertical tabs on wider viewport (>= 650px). On narrow viewports they fall back to accordion style details.
  7. Create change record.

User interface changes

  • Visually, the grouping elements will indicate that there are errors inside.
  • There will be a visually-hidden "(contains error)" appended to the summary or vertical tabs title for screen reader users.

Screenshots

Full color mode
LTR (left-to-right)

Scenario 1: Standard details (/form_test/details-contains-required-fields)

Details element containing child errors is open

Scenario 2: Accordion style details (node edit form)

Details element containing child errors is open

Scenario 3: Vertical tabs (/admin/config/people/accounts)

Tab containing child errors is active.

RTL (right-to-left)

Scenario 1: Standard details (/he/form_test/details-contains-required-fields)

screenshot submit closes a details with errors

Scenario 2: Accordion style details (node edit form)

URL alias without leading slash, Save, close "URL alias" details. Error indicator visible, no false positives on sibling details.

sceenshot url alias without leading slash

Scenario 3: Vertical tabs (/he/admin/config/people/accounts)

screenshot inactive error tab

Forced-colors mode
LTR (left-to-right)

Scenario 1: Standard details (/form_test/details-contains-required-fields)

Scenario 2: Accordion style details (node edit form)

Scenario 3: Vertical tabs (/admin/config/people/accounts)

RTL (right-to-left)

Scenario 1: Standard details (/he/form_test/details-contains-required-fields)

screenshot forced-colors mode renderring icon on details

Scenario 2: Accordion style details (node edit form)

screenshot forced-colors mode renderring icon on details

Scenario 3: Vertical tabs (/admin/config/people/accounts)

screenshot vertical tab forced-colors renderring icon

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#40 3604037-40-default-admin-standard-details-rtl.forced-colors.png50.47 KBkentr
#38 3604037-38-default-admin-vertical-tabs-rtl.forced-colors.png127.79 KBkentr
#38 3604037-38-default-admin-accordion-details-rtl.forced-colors.png82.17 KBkentr
#38 3604037-38-default-admin-vertical-tabs-ltr.forced-colors.png131.6 KBkentr
#38 3604037-38-default-admin-accordion-details-ltr.forced-colors.png90.19 KBkentr
#38 3604037-38-default-admin-standard-details-ltr.forced-colors.png50.67 KBkentr
#38 3604037-38-default-admin-accordion-details-rtl.png85.89 KBkentr
#38 3604037-38-default-admin-vertical-tabs-rtl.png138.49 KBkentr
#38 3604037-38-default-admin-standard-details-rtl.png54.63 KBkentr
#32 3604037-32-default-admin-standard-details-ltr.png55.08 KBkentr
#32 3604037-32-default-admin-vertical-tabs-ltr.png139.76 KBkentr
#32 3604037-32-default-admin-accordion-details-ltr.png99.17 KBkentr
#29 3604037-29-error-color-contrast.png13.63 KBkentr
#21 3604037-21-error-border-hidden-by-summary-background.png52.48 KBkentr
#21 3604037-21-before-after-accordion-details-regular-dark.png111.02 KBkentr
#21 3604037-21-before-after-accordion-details-regular-light.png128.37 KBkentr
#21 3604037-21-before-after-accordion-details-node-edit-dark.png110.2 KBkentr
#21 3604037-21-before-after-accordion-details-node-edit-light.png123.74 KBkentr
#21 3604037-21-before-after-standard-details-dark.png73.58 KBkentr
#21 3604037-21-before-after-standard-details-light.png85.51 KBkentr
#12 issue-3604037-review.zip75.08 KBmgifford

Issue fork drupal-3604037

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

kentr created an issue. See original summary.

kentr’s picture

Title: [PP-1] Indicate that grouping elements have child element errors for ux and a11y » [PP-2] Indicate that grouping elements have child element errors for ux and a11y
Issue summary: View changes

This might be do-able now that #3599680: Consolidate, merge, and refactor Gin's CSS variable's into Admin theme's original variables. has landed.

However, it should now wait on #2848507: Indicate that grouping elements have child element errors for ux and a11y, because that work might be usable here with only slight modifications and it will likely need UX input that will also apply to Default Admin.

kentr’s picture

because that work might be usable here with only slight modifications and it will likely need UX input that will also apply to Default Admin.

Err, and also because there are changes outside of the theme.

kentr’s picture

Title: [PP-2] Indicate that grouping elements have child element errors for ux and a11y » [PP-3] Indicate that grouping elements have child element errors for ux and a11y
Issue tags: +Usability
Related issues: +#2859914: Misleading Icon used on form validation errors
kentr’s picture

Title: [PP-3] Indicate that grouping elements have child element errors for ux and a11y » [PP-1] Indicate that grouping elements have child element errors for ux and a11y
Issue summary: View changes

It was decided that #2859914: Misleading Icon used on form validation errors isn't a blocker for #2848507: Indicate that grouping elements have child element errors for ux and a11y after all.

@mherchel said in Slack most of the big CSS refactor for Default Admin is complete.

Most of the large CSS refactoring issues are in, which means its time to take stock of what's still broken

AFAICT, #2848507: Indicate that grouping elements have child element errors for ux and a11y is very close. It might need some code tweaks, but I'm willing to take a gamble that we can start on this in parallel.

I'll work on porting the work in #2848507: Indicate that grouping elements have child element errors for ux and a11y to Default Admin. Once that issue is in, then this will be more easily testable by others.

kentr’s picture

Title: [PP-1] Indicate that grouping elements have child element errors for ux and a11y » [PP-1] Indicate that grouping elements have child element errors for ux and a11y, Default Admin
quietone’s picture

Title: [PP-1] Indicate that grouping elements have child element errors for ux and a11y, Default Admin » [PP-1] Indicate that grouping elements have child element errors for UX and a11y
Issue summary: View changes

Adding what this is postponed on to the remaining tasks per Remining tasks.

kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes
mgifford’s picture

StatusFileSize
new75.08 KB

Probably the most useful thing in this AI generated .zip is the replicate_grouping_child_errors recipe. Yes, there's a patch and more than one readme. This is all postponed on other issues, so perhaps scanning over this patch might be useful to help build a more solid one. There are also Guidepup instructions (and a diff) to help with tracking the emulation of screen reader impacts before/after.

kentr’s picture

I’ve done most of the conversion from #2848507: Indicate that grouping elements have child element errors for ux and a11y in the issue fork.

I paused to see what came out of the code review that needed to be carried over.

I didn’t create an MR because I wanted to avoid using CI minutes until it’s ready for review. Sadly, even draft MR‘s run pipelines.

kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes
kentr’s picture

Status: Active » Postponed

It's probably confusing that the status isn't Postponed...

kentr’s picture

Issue summary: View changes
Issue tags: +Needs usability review

I copied non-Claro changes from #2848507: Indicate that grouping elements have child element errors for ux and a11y because:

If #2848507: Indicate that grouping elements have child element errors for ux and a11y lands first, the corresponding commit in this issue can be reverted in the case of merge conflicts.

I'm tagging for UX review, but I'm leaving it as postponed on #2848507: Indicate that grouping elements have child element errors for ux and a11y because it's not ready for general review and the path forward is TBD.

kentr’s picture

Issue summary: View changes
Issue tags: +11.5.0 release priority
kentr’s picture

I noticed a couple of janky things that I'll fix:

  • Vertical positioning of icon in the standard details version. I messed that up trying to fix something else but missed it when I tested the change.
  • The red error border for details slices through the focus indicator on the summary.
kentr’s picture

I fixed:

  • the icon vertical alignment,
  • the janky error border slicing through the focus outline.

The fix for the latter puts the red error border below the focus outline (in the Z-plane), which also affects the version where the red border completely covered that part of the focus outline (the version labeled "accordion style details element on node edit form" below).

Before / after screenshots

Standard details element:

Before & after of standard details element in light mode

Before & after of standard details element in dark mode

Accordion style details element on node edit form:

Before & after of accordion details element on node edit form in light mode

Before & after of accordion details element on node edit form in dark mode

Regular accordion style details, such as for vertical tabs on narrow viewport:

Before & after of regular accordion details element in light mode

Before & after of regular accordion details element in dark mode

kentr’s picture

Issue summary: View changes
kentr’s picture

Note regarding focus indicator in the #21 screenshots: the focus indicator will change in #3618140: Improve the accessibility of focus outlines.

kentr’s picture

Title: [PP-1] Indicate that grouping elements have child element errors for UX and a11y » Indicate that grouping elements have child element errors for UX and a11y
Assigned: Unassigned » kentr
Issue summary: View changes
Status: Postponed » Needs work

No longer postponed on #2848507: Indicate that grouping elements have child element errors for ux and a11y. I've copied the non-theme changes from that issue to here.

The UX team looked at this in #3620853: Drupal Usability Meeting 2026-09-11. Recording: https://www.youtube.com/watch?v=2eIvoRG3GNE

I'll watch the recording to see if anything needs to be adjusted.

kentr’s picture

Issue summary: View changes
Issue tags: -Needs usability review

Not an official summary, but AFAICT from the usability meeting recording the only concerns with the MR were these:

  1. The icon vertical alignment (fixed).
  2. Inconsistencies with the way the focus indicator is handled for the different cases. On standard details elements, the focus indicator is outside (larger than) the summary, but on the vertical tabs controls and accordion style details the focus indicator is inset to the summary.
  3. Various forced-colors problems.

They were OK'd as followups.

IMO, fixing the focus indicator is out of scope because the underlying problem already exists on main. This MR just makes it more obvious.

It looks to me like the forced-colors problems need a big picture discussion.

I'm removing Needs usability review because that did occur.

kentr’s picture

Assigned: kentr » Unassigned
kentr’s picture

Issue summary: View changes
smustgrave’s picture

Testing color contrast for this one and it does fail AAA contrast with 1.4.6

Dark module this failures universally at all levels (AAA and AA).

Think we need to address those.

kentr’s picture

StatusFileSize
new13.63 KB

Thanks @smustgrave!

That's a problem in main, with the color for form "labels" in general (not specific to this MR).

Surprised we missed that... I'll create an issue for it.

Here's a screenshot of an error on the node edit form in dark mode without this MR (the error is highlighted by the Accessibility Insights extension):

kentr’s picture

Issue summary: View changes
kentr’s picture

kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes

Deleted.

kentr’s picture

Issue summary: View changes
kentr’s picture

Issue summary: View changes
kentr’s picture

Status: Needs work » Needs review
kentr’s picture

Actually, going to run pipeline before Needs review because I skipped it previously.

kentr’s picture

Status: Needs work » Needs review

Pipeline is green. There were unrelated random failures.

kentr’s picture

Issue tags: +no-ai

AFAIK no AI was used in this MR. Definitely not in the work I did, but AFAICT also not in the original work of #2848507: Indicate that grouping elements have child element errors for ux and a11y.

kentr’s picture

Issue tags: -no-ai +ai-ni

AI was not used intentionally, anyway.