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
- In
settings.php, set$settings['extension_discovery_scan_tests'] = TRUE. - Enable the core
form_testmodule (drush en -y form_test). - Install the article test recipe (
drush recipe core/tests/fixtures/recipes/article_content_type) or create an Article content type. - 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). - For "standard" details elements:
- Go to
/form_test/details-contains-required-fields. - Click the
Submitbutton. - Close one of the details elements for comparison.
- Go to
- For "accordion" style details elements on the node edit form:
- Go to
/node/add/article. - If the form sidebar on the right is closed, click the toggle button to open it.
- Enter a value without a beginning slash in the
URL aliasfield. - Click the
Savebutton.
This should cause a validation error: "The alias path has to start with a slash". - Open the sidebar to see the invalid URL alias field.
- Go to
- For vertical tabs:
- Widen your viewport to at least 650px.
- Go to
/admin/config/people/accounts. - Within one or more tabs for the
Emailsconfiguration at the bottom of the form, remove the value for the requiredSubjectfield. - Click the
Savebutton. - Click a tab which does not have an error to activate it.
For RTL, either:
- manually change the
dirattribute on thehtmltag tortlin the browser inspector / devtools, OR -
- Enable the Locale module (
drush en -y locale). - Add Hebrew as a language (
/admin/config/regional/language/add). - Repeat the above steps on the Hebrew version of the pages.
- Enable the Locale module (
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:
- Add a thick red solid border on one side of the grouping items that contain child errors.
- Border width:
var(--vertical-tabs-menu-link--active-border-size) + 2px, so that it is distinguishable fromvar(--vertical-tabs-menu-link--active-border-size). - Border position:
Logical inline start of details element or vertical tab "menu item". - Border radius:
Match the radius of the element to which the border is applied. - Add the error icon from the page-top error block to grouping elements.
- 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.
- Use red text color for the element's visible label.
- Details elements:
Surround the entiredetailselement with a 1px solid red border. - Use the input error color for the red border / red text (
var(--input--error-color)). - 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. - Append visually-hidden " (child error)" to the element's visible label.
- Add the attribute
data-child-error-countto thedetailselement.
Because vertical tabs are progressively-enhanceddetailselements, the attribute will exist on the correspondingdetailselement but not on the vertical tabs menu item (thelielement).
The value of the attribute should be an integer corresponding to the number of invalid children. - For the icon in forced-colors mode, use the
mask-imageproperty andcanvasTextbackground 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
Adapt work from #2848507: Indicate that grouping elements have child element errors for ux and a11y to Default Admin.Create merge request.Usability review.Forced colors mode for icon.Fix details error border position for RTL.- Manually test LTR, RTL, forced colors, and presence of hidden text for the following:
- Standard style details.
- Accordion style details (such as in advanced sidebar on node edit form).
- Vertical tabs on wider viewport (>= 650px). On narrow viewports they fall back to accordion style details.
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)

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)

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.

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

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)

Scenario 2: Accordion style details (node edit form)

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

Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3604037
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
Comment #2
kentr commentedComment #3
kentr commentedThis 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.
Comment #4
kentr commentedErr, and also because there are changes outside of the theme.
Comment #5
kentr commentedBased on UX feedback in #2848507-212: Indicate that grouping elements have child element errors for ux and a11y, I think this is also blocked by #2859914: Misleading Icon used on form validation errors.
Comment #6
kentr commentedIt 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.
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.
Comment #7
kentr commentedComment #8
quietone commentedAdding what this is postponed on to the remaining tasks per Remining tasks.
Comment #9
kentr commentedComment #10
kentr commentedComment #11
kentr commentedComment #12
mgiffordProbably 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.
Comment #13
kentr commentedI’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.
Comment #14
kentr commentedComment #15
kentr commentedComment #16
kentr commentedIt's probably confusing that the status isn't Postponed...
Comment #18
kentr commentedI 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.
Comment #19
kentr commentedWhen @mgifford and I talked about it last, we thought this is a blocker for #2915899: [PP-1] Enable the Inline Form Errors module in the Standard profile and recipe for the same reasons that #2848507: Indicate that grouping elements have child element errors for ux and a11y is.
Comment #20
kentr commentedI noticed a couple of janky things that I'll fix:
detailsversion. I messed that up trying to fix something else but missed it when I tested the change.detailsslices through the focus indicator on thesummary.Comment #21
kentr commentedI fixed:
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
detailselement on node edit form" below).Before / after screenshots
Standard
detailselement:Accordion style
detailselement on node edit form:Regular accordion style
details, such as for vertical tabs on narrow viewport:Comment #22
kentr commentedComment #23
kentr commentedNote regarding focus indicator in the #21 screenshots: the focus indicator will change in #3618140: Improve the accessibility of focus outlines.
Comment #24
kentr commentedNo 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.
Comment #25
kentr commentedNot an official summary, but AFAICT from the usability meeting recording the only concerns with the MR were these:
detailselements, the focus indicator is outside (larger than) thesummary, but on the vertical tabs controls and accordion styledetailsthe focus indicator is inset to thesummary.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.
Comment #26
kentr commentedComment #27
kentr commentedComment #28
smustgrave commentedTesting 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.
Comment #29
kentr commentedThanks @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):
Comment #30
kentr commented#3625458: Form error text in dark mode has low contrast
Comment #31
kentr commentedComment #32
kentr commentedScreenshots for change record.
Comment #33
kentr commentedComment #34
kentr commentedComment #35
kentr commentedDeleted.
Comment #36
kentr commentedComment #37
kentr commentedComment #38
kentr commentedAdding screenshots to IS.
Comment #39
kentr commentedComment #40
kentr commentedActually, going to run pipeline before Needs review because I skipped it previously.
Comment #41
kentr commentedPipeline is green. There were unrelated random failures.
Comment #42
kentr commentedAFAIK 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.
Comment #43
kentr commentedAI was not used intentionally, anyway.