Problem/Motivation
When Gin was moved over from contrib, it used box-shadow as a focus outline (Claro did so too for a while).
However, the vast majority of this has been rectified in default_admin as the CSS was refactored. However there several places where box-shadows may still be utilized as focus outlines. These need to be removed.
The focus outlines also utilize transparency, which can lead to potential issues. We need to refactor that out.
Related is #3619933: Drupal Admin Theme Colors
Steps to reproduce
Proposed resolution
- Remove transparency from focus outline
- Remove all box shadows from focus outline
- There appears to be some left over in media library
- Remove the variables too
- Appears to be one box shadow focus state in dropbutton (line 636)
- Also form checkbox
- Ensure default focus outline meets 3:1 contrast over lightest surface color
Remaining tasks
User interface changes
Regular foucs
Before

After

High contrast
Before

After

Introduced terminology
NA
API changes
NA
Data model changes
NA
Release notes snippet
NA
Comments
Comment #2
kentr commentedIS needs updating for Default Admin.
Notes:
variables.pcss.css.--focus-outline(currentlyvar(--outline-size) solid var(--admin-color-focus)).--outline-size(currently.25rem/4px).--focus-box-shadow(currently0 0 0 var(--focus-border-offset-size) var(--admin-color-bg-surface), 0 0 0 calc(var(--focus-border-size) + var(--focus-border-offset-size)) var(--admin-color-focus);).Comment #3
kentr commentedComment #6
mgiffordComment #7
mgiffordComment #8
mgiffordThere are a number of places where I think we should be setting an outline where it isn't right now. I've included a patch and an interdiff. All AI generated.
Comment #9
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #10
mherchelMet with @mgifford @jurgenhaas @boromor to discuss and refactor the issue summary on this issue, since it's copied verbatim from the Gin issue queue and is out of date.
Comment #12
mgiffordWith the conflict here https://git.drupalcode.org/project/drupal/-/merge_requests/16774/conflicts
I think we want the new variable names (not gin) but to remove the opacity. So something like:
Comment #14
smustgrave commentedComment #15
smustgrave commentedComment #16
smustgrave commentedComment #17
smustgrave commentedFixed the performance test now we are all green
Comment #18
gábor hojtsyIssue summary called for removing the box shadow which was not entirely removed yet. Also @mgifford raised in #12 the situation of the non-default accents also not meeting accessibility guidelines. So looked at these with LLM guidance.
In accent.pcss.css the four non-default presets now use solid light and dark pairs. Green uses the values @mgifford proposed in #12. The other two pairs are derived the same way, a darker tone for light mode and a lighter one for dark mode, and all meet 3:1 on the theme's lightest and darkest surfaces. The accent preset simply uses the primary colour itself. These are design choices, so need to be reviewed for that.
Also, the media library preview wrapper, the dropbutton item at the old line 636, and the checkbox and radio rings for the checked, error, and error-checked-radio states now rely on the outline only. The two box-shadow variables are removed. The remaining offset variable is renamed to
--outline-offsetso it sits next to--outline-sizeinstead of using the old box-shadow name; it is used in the same four places as before.Comment #19
smustgrave commentedCould we get updated screenshots?
Comment #20
mherchelTaking a look around, it looks like some focus states are still set to box shadow:
I had Claude scan and it found these
components/form--checkbox-toggle.pcss.css:73.form-type--checkbox inputcomponents/views-ui.pcss.css:1226.views-tabs .add a:focusoutline: nonecomponents/node-preview.pcss.css:111.node-preview-container *:focusoutline: nonecomponents/icon-link.pcss.css:31.icon-link:focus.icon-link--small:focus0 0 0 1px --admin-color-bg-surface, 0 0 0 3px --admin-color-focusComment #21
mherchelEverything else looks good besides 👆
Comment #22
gábor hojtsyAsked my agent to help with screenshots because this would have taken hours :) It could not screenshot inside the media dialog, had issues opening it. Otherwise here are the before/afters.
Default outline
Button
Text input
Theme settings pill radio
Box shadows replaced by outlines
Checked checkbox
Unchecked checkbox
Radio
Toggle switch
Dropbutton item
Views UI add display link
Media library item
Media library remove icon link
Focus colour presets
Green
Orange
Accent
Green, dark mode
Comment #23
gábor hojtsyThe views add button screenshot was showing an issue :) The Views tabs block in
views-ui.pcss.csshad ana:focus { outline: none; }covering every tab link. On main the Add link was the only one with a visible focus state, through its own box-shadow ring. The earlier change removed that ring and assumed the theme's default outline would take over, but this rule kept suppressing it, so the Add link ended up with nothing. Not this rule is removed. The default outline now reaches the Add link, as the new screenshots show, and as a side effect the display tabs themselves, such as "Page", also get a focus outline when tabbed to, which they never had before.So a positive side effect as that these DID NOT have focus states before but now they do:
Views UI display tab, non-active
Views UI display tab, active
This was done again with LLM assistance.
Comment #24
gábor hojtsyIn #22 I mentioned my LLM had issues with the media dialog, figured that out and also filling in the missing screenshot for the node preview bar. I personally think these look good :)
Media library dialog, select checkbox
Node preview bar, back link
Node preview bar, view mode select
Comment #25
smustgrave commented@gabor you rock with the perfect screenshots! That made reviewing so much easier. This looks good
Comment #27
catchNever feel confident when I open a CSS MR whether I'm going to feel competent enough to commit it or not, but this is another one where the resulting CSS is simpler than what it's replacing, and the screenshots and manual testing done on the issue make it clear it's doing what it's supposed to.
Committed/pushed to main, thanks!
Comment #29
catchGot slightly over-excited here we need an 11.x backport MR.
Comment #32
mherchelBackported! Had to update
StylesheetBytesincore/profiles/demo_umami/tests/src/FunctionalJavascript/MultipleRequestsPerformanceTestAssertions/umamiNodeAddEditor.yml