Problem/Motivation
The Claro and shortcut module star icons don't satisfy WCAG Success Criteria 1.4.1 "Use of Color", or 1.4.11 "Non-text contrast".
-
The grey outline of the star is too faint. It has a contrast ratio of just
2.78:1against Claro's grey page background. -
The yellow fill isn't sufficiently distinguishable from the transparent fill.
-
For the Claro icons, the contrast between the yellow and the grey page background is
1.29:1. -
For the shortcut module icons, the contrast between the yellow and a white page background is
1.1:1.
-
For the Claro icons, the contrast between the yellow and the grey page background is
- The yellow-fill is the only indication of state. On its own, it isn't a reliable signifier. Even if these did have good contrast in the full-colour situation, the state can still be difficult for some users to notice: users with a colour vision impairment, or other visual impairments, or who have adjusted the colour space in some way, or where the screen is overpowered by ambient light.
- When a Windows high-contrast theme is used, the star remains the same colour. We cannot rely on either the grey outline or the yellow fill to be distinguishable from the page background, because we cannot know what the background colour will be.
Steps to reproduce
Setup
- Do a standard profile install.
- Log in as User 1.
Full-color
- Go to any admin page (to see Claro icons).
-
Cycle through the shortcut actions & observe that
- the shortcut icons have a thin, light gray outline
- the "remove" states have a yellow fill
-
Go to
/user/1(to see shortcut module icons on Olivero theme). -
Cycle through the shortcut actions & observe that
- the shortcut icons have a thin, light gray outline
- the "remove" states have a yellow fill.
Expected
- The icons should have sufficient contrast against the light gray Claro header background.
- The icon states should all have sufficient contrast to be easily distinguishable from each other by users with a colour vision impairment, or other visual impairments, or who have adjusted the colour space in some way, or where the screen is overpowered by ambient light.
Forced-colors
-
Enable
forced-colorsmode (see below). - Observe that all icon states are the same color as for full-color mode.
Expected
-
The colors for all icon states should match the user's chosen
LinkTextcolor.
Proposed resolution
-
Change the Claro shortcut icons as so:
-
All icon states: Slightly thicker stroke (
1.5). -
Default "add" state: Darker gray (
--color-gray-800/#55565b). -
"add" hover state: Blue stroke (
--color-blue-600/#003ecc). -
Both "remove" states: Blue stroke and fill (
--color-blue-600/#003ecc).
-
All icon states: Slightly thicker stroke (
-
In a
(forced-colors: active)CSS media query, use themask-imageproperty withbackground: linktext, as is done with other icons. - Apply the Claro icon and corresponding CSS changes to the shortcut module.
These screenshots are from Firefox Mac in standard mode and with forced-colors emulation, respectively.
Testing notes
The following cases need testing for both Claro and Olivero theme (meaning that there are eight total cases to test):
-
Full-color, left-to-right (
ltr) direction. -
Forced-colors, left-to-right (
ltr) direction. -
Full-color, right-to-left (
rtl) direction. -
Forced-colors, right-to-left (
ltr) direction.
Use the setup and execution from Steps to reproduce, but with both text directions.
Enabling forced-colors
- Windows: Enable Windows High Contrast Mode
- Firefox: In the Color Settings, force-enable high-contrast mode (aka, "FF HCM").
-
Chrome: Enable
forced-colorsemulation.
Enabling right-to-left direction
-
In the browser DevTools, change the
directionattribute on the page'shtmlelement tortl.
Remaining tasks
- Review changes
- Test manually
User interface changes
- Claro: The shortcut icons will change in color only.
- Shortcut module: For any theme that doesn't explicitly override the shortcut module icons, the shortcut icons will change in style and color.
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #71 | 3171726-nr-bot.txt | 91 bytes | needs-review-queue-bot |
| #69 | grey.jpg | 8.33 KB | rkoller |
| #69 | page_colors.jpg | 128.82 KB | rkoller |
| #69 | rendering.jpg | 126.27 KB | rkoller |
| #69 | comparison.jpg | 428.83 KB | rkoller |
Issue fork drupal-3171726
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
dyannenovaComment #3
dyannenovaComment #4
katherinedI used the same approach here as in #3171727-3: Claro breadcrumb divider needs Windows High Contrast mode improvements. The only possible downside is the same, that the star is now darker without high-contrast mode, but I think it's worth the trade-off.
Chrome before:

Chrome after:

Firefox Windows high-contrast after:

Comment #5
dyannenovaThis looks like a good solution. It's a bit more noticeable than the breadcrumb update, but it still fits in with the overall aesthetic of Claro, and it's a nice accessibility improvement.
Comment #6
ckrinaLooks 👍 to me too. It's worth loosing some aesthetic if it's improving accessibility.
Comment #7
lauriiiGiven that the star is now darker than the text, it does stand out quite a bit. It seems fine for now, but should we open a follow-up to see if we could implement the original design after something like https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_Med... is supported by Firefox?
Comment #8
andrewmacpherson commentedMore screenshots please. Is it possible to tell the two states apart in Windows High-Contrast themes (pages added / not added to shortcuts)?
To be honest, the shortcut star performs poorly in the full-colour space too, where it fails WCAG SC 1.4.1 "Use of Color" (level A) and SC 1.4.11 "Non-text contrast" (level AA).
We can't rely on a yellow fill to be noticable compared to the transparent fill (grey, in effect). For example, some users with dyslexia employ a whole-screen colour filter to make text easier to read (sometimes software, sometimes a plastic sheet). There's a good discussion of this in Understanding Success Criterion 1.4.11: Non-text Contrast, specifically illustrating the problem of yellow-filled vs. empty stars.
There's also a very straight-forward solution by using a single colour for both the fill and stroke. (The Firefox URL bar uses this for browser bookmarks; a black star outline changes to a solid blue star.)
Rather than put a band-aid fix for Windows HC, I think we should broaden the scope of this issue to fix the shortcut star in all colour spaces at once, and remove the need for a media query.
Comment #9
andrewmacpherson commentedBumping to major because it fails a level-A WCAG success criterion.
Comment #10
andrewmacpherson commentedEdited the issue summary to explain why this isn't just about using Windows high-contrast feature.
Comment #11
katherinedThanks for the link in #8!
I'm attaching two patches with different approaches. One provides a star with a thicker border in the selected state. The other provides a solid fill in the selected state. The solid patch uses
currentColor, but it could work with any solid color as long as the contrast is sufficient on all backgrounds.I have a slight preference for the yellow star with a thicker border.
Comment #12
katherinedIt looks like I switched the patch names in the previous comment. Fixed here, and adding a better screenshot.
Comment #13
andrewmacpherson commentedThanks for working on this @katherined.
Review of #12:
The "not selected" screenshots: everything is good. It's fixes the problem in the full-colour space, where the grey star outline didn't have enough contrast against the grey page background. It also adapts well to Windows high contrast modes, in all browsers, because it just uses current colour everywhere.
From a cosmetic view, I think the "yellow fill and thick border" variant is quite messy (in a "too-much ink" way). I not sure if the thick border is a strong affordance of "selected" either; the situation isn't the same as the 5-star ratings widget where you can see a row of stars, and the filled ones come before the unfilled ones in the reading order. For our shortcut, we only have one star, and there is no other star on the page to compare it to.
Your screenshots only show what it looks like with the black/white high contrast themes which are pre-configured in Windows. However I don't think the yellow fill version would work well at all for user-specified high contrast themes, where the page background can be literally anything. It won't show up if the user picks a yellow or beige background.
The single-colour "alternative" version is more elegant to me. The difference between a filled and unfilled star is very stark, and works well in the high-contrast themes. But I think it's too heavy (and a bit boring) in the full-colour space.
Comment #14
andrewmacpherson commentedHere's an experiment of mine. It uses concentric stars.
This is what it looks like in the full-colour space:
A solid star is inside a hollow star. The fill doesn't directly touch the outline of the star; there's a transparent space in between. The shortcut icon behaves somewhat like a single checkbox, with a checked vs. not-checked state. So I'm trying to keep the same sort of distinction between the border and the fill, but without having low-contrast colours. I'm aiming for something similar to a radio button, which usually has a gap between the outer circle and the bullet fill.
I also wanted to see if we could get a colour-adaptive icon without needing alternative image files. So the SVG has a
<style>element, with it's own-ms-high-contrastmedia query. The un-filled star is grey, so it isn't as overpowering as usingcurrentColourwhich matches the heading text. We can go for a grey which has over 3:1 contrast against the page header (#808080 gives a 3:48:1 contrast ratio).But when the star is filled, we can still employ colour. I used blue for both the outline and the fill. There's already a lot of blue in Claro to represent active/selected, and this is very much like the selected radio button style (but you know, spiky). It'll have much better contrast than yellow. It's also what Firefox and Chrome do in for browser bookmarks in the URL bar; and empty grey star changes to a filled blue star.
In Windows High Contrast mode, all colours are switched to
currentColor, but the transparent gap between the outline and fill is still there. Here's what it looks like with a black-on-white theme:I always like to test Windows high-contrast with user-specified colours. Here's a sepia-on-rose custom scheme I cooked up (some people deliberately use a low contrast palette!).
The high-constrast screenshots here show IE11, Edge (pre-Blink), and Firefox. The snag is that Firefox doesn't support the high-contrast media query, so the filled star still appears blue. Firefox has always been a poor relation to the MS browsers for high-contrast mode. I'm happy with this; so long as we can get it working well for the MS browsers, that's good. We can wait for the
forced-colorsmedia query which is going through CSS standardization.So far it's just an SVG file, rather than a Claro patch, and I haven't done the add/remove crosses yet. I think the thickness of the solid border and transparent gap might need some adjustment too.
Comment #16
ckrinaThank so @andrewmacphersonfor the proposal! I do like the blue fill much more than the yellow one. Based on your proposals, I've prepared this to get more context:
Once zoomed, I do like the star inside the star emulating the radio styles, but at a smaller size (like the one we're using) it can look blurry or too "crowded". It would also introduce changes on the SVG depending on the size because a 2px spacing might be too much in smaller icons vs too small on the bigger ones, and I'd try to avoid that if possible. I think the contrast with the blue filled vs non-filled grey when it's not saved should be enough:
With the "filled" when it's saved should be good enough to let people understand:
@andrewmacphersonwhat does this make sense to you?
Comment #17
mgiffordLinking open issues from the VPAT - https://github.com/CivicActions/accessibility/blob/main/VPAT/Drupal9Acce...
Comment #18
andrewmacpherson commentedThanks for the feedback @ckrina. That's a good point about the rendering at smaller sizes. I mentioned that the thicknesses might need adjusting, and I guess it just suffers from anti-aliasing at small sizes.
I'm happy to go with your proposal to just use a solid fill, rather than my concentric stars idea.
Comment #19
volkswagenchickAdding
NorthAmerica2021andEasy Out of the Boxtags for visibility.DrupalCon NA is April 12-16 with a focus on EOOTB on Wednesday, April 14.
Thanks
Comment #20
mgiffordComment #23
jenniferhoude commentedCreated MR and adding patch
Comment #24
jenniferhoude commentedComment #26
andrewmacpherson commented@jenniferaube: Thanks for working on this. It's a good start - it gives us the basic empty and solid stars we need. The colours need work though.
Manual testing of patch #23...
These screenshots were all taken with Edge v90. I tested the full-colour space, and 3 versions of Windows high contrast mode.
In all cases, the star is black. It shows up well against a light background, but is invisible when using a Windows high-contrast theme with a black background.
Today, my custom high-contrast colour scheme is pink-on-purple, with orange links (it could be anything). A black star isn't good contrast here.
Code review of patch #23...
This addition isn't necessary. The
shortcut.cssfile is already declared as part of theclaro/drupal.shortcutlibrary, later in the file. It's styling for a module, so the CSS file is only added when shortcut module is enabled, and the user has the right permissions.shortcut.css, but they should be made inshortcut.pcss.css. The CSS files in Claro are generated via PostCSS. See Drupal core using PostCSS for development and Frontend Developer tools for Drupal core.There are two
fillattributes here, and they are both hard-coded black. The reason thecurrentColoralways ends up black, is because it's specified in an SVG attribute. It's something to do with the browser starting a new render root (terminology?) for an SVG-as-CSS-background-image, and the initialcurrentColoris black.In #14, my experiment used a style element in the SVG itself, with CSS stroke/fill properties instead of SVG stroke/fill attributes. Then
currentColorworks out the same as the system plain text (I don't yet grok why...).Needs work:
LinkTextsystem colour inside a high-contrast media query, for all states.Comment #27
andrewmacpherson commented@mgifford: Did you mean to tag this wcag131? SC 1.3.1 is "Info and Relationships". That's not the issue here; the visible information is conveyed via markup. I looked at the other issues tagged wcag131 and they're all about high-contrast.
Comment #29
javi-er commentedHi there, I made the changes pointed out on #26, adding inline styles on the svg with a media query for detecting high contrast mode worked really well. I pushed the changes to the existing merge request, not sure if that's better than starting a new merge request.
Here's how it looks now on Chrome and Edge with high contrast enabled:
Comment #30
volkswagenchickTagging for Design4Drupal 2021. Contributions are Friday, July 22
https://design4drupal.org/
Comment #31
volkswagenchickCorrecting tag Design4Drupal2021
Comment #32
mherchelAdded some comments in the MR.
The star does not show in IE11 high contrast mode also.
I'm going to spend a bit of time on this.
Comment #33
mherchelAttached is a new approach (so no interdiff).
Screenshots:

IE:
Edge:

FF:

Comment #34
mherchelThe previous patch still allowed the core shortcut module to insert a RTL version of the star as a background image, which would show in Edge and FF.
This patch overrides that behavior.
Comment #36
mherchelThis looks like an unrelated failure. Re-queuing the tests.
Comment #37
m4oliveiI like the simplification for WHCM / forced-colors using unicode characters instead of trying to get the SVG to work. It's also great that you don't need to mess with color overrides for WHCM / forced-colors since it's just text, which the user agents handles well.
One thing I noticed. The merge request included the blue stars design. The recent patch is missing that and shows the yellow stars.
Comment #38
m4oliveiHere's an updated patch with the blue stars
.svg.Comment #39
volkswagenchickAdding tag for DrupalCon
Europe2021. ThanksComment #40
andrewmacpherson commentedThanks for working on this everyone. I'm afraid I've lost track of whether to look at the merge request or the patches here.
Whichever it is, please don't use the Unicode stars - go back to using the SVG stars.
Short version: using Unicode symbols like this is extremely fragile in situations where users specify their own fonts (in browser preferences, OS preferences, or user stylesheets). For detailed reasons, review the Slack conversation in #3223281-19: Olivero: Primary nav search icon invisible in forced-colors mode in MS Edge.
I found a survey of Unicode character ranges and the Unicode fonts that support them. The list of fonts supporting the Miscellaneous Symbols block isn't very long. The page was last updated in 2012, so I imagine more actively maintained fonts may support it by now. However I'd assume that older, unmaintained proprietary fonts won't have gained support for Miscellaneous Symbols.
Also remember there are FOUR star icons used by the shortcut widget, not two. The Unicode stars don't have accompanying
+orxsigns like the existing SVG version does.Re. #32: The reason the star doesn't show in MSIE is that is strips out CSS background images, on the assumption that they interfere with overlying text. This behaviour has been superceded by the text-backplate in Legacy-Edge and the modern CSS forced-colors standards. You can still get a CSS background image in MSIE, but you have to explicitly restore it using the legacy vendor media feature
-ms-high-contrast: active. I think that also works for style elements inside an SVG.I'm away-from-Windows right now, but I'd like to try the older versions out which still use SVG.
(updated; fixed broken markup)
Comment #42
ckrinaPer @andrewmacpherson 's comment, we can't use the unicode solution posted on #33 and the improvements on that on #38.
So we have to go back to the solution in #29 and test it.
Comment #43
mherchelAs referenced in #3227431-12: Tabledrag icon doesn't adapt to forced-colors mode, we could also use the CSS
clip-pathproperty. This works well in high contrast, but has been not been an option due to lack of IE11 support. If we move this issue to 10.0.x, it'd be a LOT easier to implement fixes like these.Here's a codepen demo: https://codepen.io/mherchel/pen/qBPaeEQ?editors=1100
Comment #44
mherchelHere's a codepen demo with a star shape. This will work great in high contrast mode*
Two issues:
https://codepen.io/mherchel/pen/JjrgvjY
If we go this route, we can either 1) commit it to both 9.4.x and 10.0.x (and file a followup for 9.4.x that'll likely never get solved). Or, we can just commit it to 10.0.x.
If this solution won't work, we'll need to refactor the shortcut module to utilize a twig template so we can inline the SVG markup. But, IMHO, this isn't too bad.
Comment #45
effulgentsia commentedAccording to #3066007: Roadmap to stabilize Claro, this is a "must have" for Claro to be Stable. I don't know if that's accurate, but if it is, then it would be really great to have Claro stable in 9.4, because that would allow us to move Seven from core to contrib for Drupal 10, and have one less theme to maintain in core.
Changing Shortcut module to use a twig template doesn't sound like a bad idea to me, unless it introduces BC concerns. If we do that, I still like the idea of a 10.0.x follow-up to make it better once IE11 no longer needs to be supported.
If we think a non-IE solution would be significantly better than one that accommodated IE, another idea is we could just not provide Shortcut functionality at all in IE in Claro? And any Drupal 9 sites still accommodating editors/administrators using IE could just choose to remain on Seven?
Comment #46
mherchelYeah, thats my attitude. I don't think there's that many.
This would be the ideal solution. My codepen above is CSS only, and it will work, but a theme being able to override the template would be better and more flexible going forward. I personally don't have the PHP chops to get that done, but if you or someone else wants to introduce the template, I'll modify that (as well as all of the relevant CSS) to make it work.
I don't anticipate any BC changes if we have the default template reproduce the current markup.
Comment #47
effulgentsia commentedAre these two spans what should be in a twig template? Should the entire link be in that template, or only the two spans and keep the link itself still using the generic
'#type' => 'link'as currently?Comment #48
mherchelEither would work.
That being said, if they're both equal amounts of work, it makes more sense to put the entire hyperlink into the template, as long as we can insert markup within the
<a>tag.Comment #49
mherchelDiscussed this with @lauriii. He agreed that because 1) this issue happens in other themes (it happens in all the themes) and 2) the resolution is within the shortcut module, the core component should be changed to the Shortcut module.
Comment #52
mgiffordComment #53
mgiffordComment #54
mgiffordMy mistake on tagging this 131. I should have gotten back to Andrew on that sooner.
Comment #56
kentr commentedI'm going to try to move the MR forward a little.
Adding Needs issue summary update because the IS mentions IE11 and AFAIK Drupal dropped support for IE11.
Comment #58
kentr commentedThere were merge conflicts when updating the existing MR branch, so here's a new MR against
11.x.Some comments
forced-colors: active.That wasn't in @ckrina's screenshots, and due to the
+above the star in the Claro icons I wondered if it is necessary. So I left the fill empty for now as shown in the screenshots.url()function, the SVG with aforced-colors: activemedia query embedded in astyleelement did not display theLinkTextcolor as expected.However, there are many instances in core of using
mask-imageforforced-colors: active, so I went with that method.I suggest creating a lower-priority followup to refine the shortcut module's icons since they'll appear on Olivero (which has different blues).
These screenshots are from Mac Firefox in standard mode and with
browser.display.document_color_useset to2.Needs manual testing with & without forced-colors / WHCM. I will update the IS with details.
[Edited to correct missing screenshots]
Comment #61
smustgrave commentedHave not reviewed but previously tagged for issue summary update
Tried to cleanup what I assume are old tags.
Comment #62
kentr commentedI'm working on the IS update.
Comment #63
kentr commentedUpdated the IS, included testing notes, and attached the screenshots that didn't save for #57.
Comment #64
kentr commentedForgot to change status / remove IS update.
Comment #65
smustgrave commentedBefore
After
Does appear to address the failure
Waiting on a maintainer to make sure they're fine with the color change.
Comment #66
smustgrave commentedActually see in #6 ckrina gave the thumbs up.
Comment #67
kentr commented@smustgrave I think the version here is different than what @ckrina was thumbing up in #6.
There were several iterations. The latest before I worked on it had the "concentric" stars. I didn't use that version because of @ckrina's comment in #16:
My version is closest to @ckrina's screenshots in #16. I added the little "+" and "x" in the corners of the hover versions.
Changed back to NR just in case.
Comment #68
rkollerhm that is odd, i've tested MR11498 in Edge with high contrast mode on macos sequoia, the star in the screenshot in #58 looks okay to me, but in my own testing the star is barely visible in each of the two states.
unchecked:


checked:
the none-forced color mode on the other hand looks good and also in line with #16 as @kentr stated in #67
Comment #69
rkollerFollowup for #68. The reason why the two star states were barely visible was my usage of the "enable automatic dark mode" setting in the edge rendering tab. Even though it uses also
prefers-color-scheme: darkit is still behaving off. @kentr and I had a discussion and some further digging over in: https://drupal.slack.com/archives/C2ANFUGGG/p1746978093222529We still dont know the exact reason why the "enable automatic dark mode" setting is behaving differently output wise, but the following pen @kentr created illustrates the behaviro pretty well between the two approaches: https://codepen.io/kentr/full/XJJyerz (...and narrows down the cause to the
color-schemeproperty as the key factor) .enable automatic dark modeon the left andprefers-color-scheme: darkon the right.the
color-schemeproperty is not used in core so far (only gin uses it in a few places). therefore the suggestion for the way forward would be two fold, to open up a followup issue adding something liketo core in general as suggested in the almanac on css tricks ( https://css-tricks.com/almanac/properties/c/color-scheme/). that way all elements of the page/site get opted into both color schemes making those elements theme-able in the forced color mode. and for testing avoid "enable automatic dark mode" nevertheless, instead use the following two settings (here in microsoft edge)
And the star looks good with
prefers-color-scheme: darkas well as all the available page color themes available. The only small nitpick i might have and i just noticed last night, in forced color mode the unchecked star border is yellow and the checked star is filled yellow. while in none forced color mode the checked star is blue which is in line with the forced color mode, since the color blue stands for links. but the unchecked star border is black / gray.so i wonder shouldnt the star in the unchecked state also have a blue border for consistency and semantics?
Comment #70
kentr commentedRE #69
Looking into Automatic Dark Mode further, my take is that the feature is just buggy. AFAICT, these are issues for it. It also appears to still be in a dev stage.
This is a good point. I was trying to follow @ckrina's colors in #16. Does this change need designer approval?
Comment #71
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 #73
quietone commentedThe Shortcut Module was approved for removal in #3476880: [Policy] Move Shortcut module to contrib.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3569117: [meta] Tasks to deprecate the Shortcut module and the removal work in #3569121: [meta] Tasks to remove the Shortcut module.
Shortcut will be moved to a contributed project before Drupal 12.0.0 is released.