Problem/Motivation
In the theme settings, the color picker fields for custom accent and focus colors are missing accessible names.
This occurs both:
- On the admin page settings form.
- On the user settings form when the "Users can override Default Admin settings" option is enabled (therefore, regular users can encounter this).
WCAG success criterion
SC 4.1.2 Name, Role, Value (Level A)
Deque impact rating
Critical
Accessibility Insights reports

Title: WCAG 4.1.2: Ensure every form element has a label (#edit-accent-picker)
Tags: Accessibility, WCAG 4.1.2, label
Issue: Ensure every form element has a label (label - https://accessibilityinsights.io/info-examples/web/label)
Target application: Default Admin | Drush Site-Install - https://drupal-core-dev.ddev.site/admin/appearance/settings/default_admin
Element path: #edit-accent-picker
Snippet: <input data-drupal-selector="edit-accent-picker" type="color" id="edit-accent-picker" name="accent_picker" value="" class="form-color form-element form-element--type-color form-element--api-color">
How to fix:
Fix any of the following:
Element does not have an implicit (wrapped) <label>
Element does not have an explicit <label>
aria-label attribute does not exist or is empty
aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
Element has no title attribute
Element has no placeholder attribute
Element's default semantics were not overridden with role="none" or role="presentation"
Title: WCAG 4.1.2: Ensure every form element has a label (#edit-focus-picker)
Tags: Accessibility, WCAG 4.1.2, label
Issue: Ensure every form element has a label (label - https://accessibilityinsights.io/info-examples/web/label)
Target application: Default Admin | Drush Site-Install - https://drupal-core-dev.ddev.site/admin/appearance/settings/default_admin
Element path: #edit-focus-picker
Snippet: <input data-drupal-selector="edit-focus-picker" type="color" id="edit-focus-picker" name="focus_picker" value="" class="form-color form-element form-element--type-color form-element--api-color">
How to fix:
Fix any of the following:
Element does not have an implicit (wrapped) <label>
Element does not have an explicit <label>
aria-label attribute does not exist or is empty
aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
Element has no title attribute
Element has no placeholder attribute
Element's default semantics were not overridden with role="none" or role="presentation"
Steps to reproduce
- Install Drupal with the Standard profile.
- Log in as admin.
- Install the Default Admin theme and set it as the administration theme.
- Go to
/admin/appearance/settings/default_admin.
- Select the "Custom" option for the "Accent color" and "Focus color" fields.
- Run a test with the Axe-core or Accessibility Insights extensions.
Proposed resolution
In Settings::getSettingsForm():
- Add
#title properties for the fields.
- Hide the labels with
'#title_display' => 'invisible'.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
kentr commentedComment #3
kentr commentedComment #4
kentr commentedSplitting changes back out from #933004: Test that all form elements have a #title for accessibility.
Changed parent to #933004: Test that all form elements have a #title for accessibility for tracking the cases of empty / missing
#titlevalues.Comment #6
mgiffordConfirmed.
Comment #7
kentr commentedThanks @mgifford!
It should probably be Needs work because the pipeline is failing.
I think the failure is unrelated, but I don't have the ability to rerun failed jobs to verify.
Comment #8
mgiffordThis is a pretty simple screenshot from /admin/appearance/settings/default_admin
Seemed to apply fine on my end. Adding a Tugboat screenshot (with no Accessibility Insights errors).
Comment #9
kentr commentedThanks for trying it out. If you want to mark it RTBC, we can see what the higher-ups think about the test situation.
Comment #10
kentr commentedI take that back.
This test passes locally for me, but I'll make changes corresponding to the CI report. Might be due to different environments.
Comment #11
kentr commentedAfter I changed the test and then reverted it to address the new failure that wanted the old values, the pipeline is now passing.
Comment #12
jurgenhaasThis is looking good to me, great work @mgifford and @kentr, thanks a lot.
Comment #13
mherchelVerified labels are showing. Commit incoming.
Comment #15
mherchelCommitted and pushed 16ba75529b3 to main. Thanks!
Comment #18
mherchel