Page MenuHomePhabricator

Define Codex tokens for text-highlight and target text
Open, MediumPublic

Assigned To
Authored By
Jdlrobson-WMF
Mon, Nov 24, 9:09 PM
Referenced Files
F70825004: image.png
Tue, Dec 2, 9:03 PM
F70824988: image.png
Tue, Dec 2, 9:03 PM
F70660006: image.png
Wed, Nov 26, 1:36 AM
F70660004: image.png
Wed, Nov 26, 1:36 AM
F70660002: image.png
Wed, Nov 26, 1:36 AM
F70659999: image.png
Wed, Nov 26, 1:36 AM
F70659996: image.png
Wed, Nov 26, 1:36 AM
F70659993: image.png
Wed, Nov 26, 1:36 AM

Description

To support building T410925: Highlighted text is not accessible when deep linking into a dark mode article. we need color tokens for highlighting text (using mouse) and highlighted text (when landing on site using a search example link)

I think these are default browser styles. We probably need a design token for ::selection (the brown color - which seems to be when you highlight the text yourself) and ::target-text (the purple/pink color) if we want to ship our own styles and then we can update all skins to use it.

These colors should work in dark mode as well as light them.

selecting text with mouse:

image.png (2×1 px, 476 KB)

target text:

image.png (976×1 px, 604 KB)

Event Timeline

Thanks for this task. I will work on this. Before I start on this, I want to clarify the current colors I'm seeing, which I imagine are browser defaults.

Chrome Light
image.png (408×510 px, 74 KB)
Chrome Dark
image.png (438×626 px, 93 KB)
Safari Light
image.png (440×486 px, 77 KB)
Safari Dark
image.png (386×358 px, 51 KB)
Firefox Light
image.png (436×444 px, 72 KB)
Firefox Dark
image.png (446×588 px, 92 KB)
target highlight#EED1FF (light pink)#EED1FF (light pink)#FFECB9 (light yellow)#A28E5A (mid brown)#FFEAC9 (light yellow)#FFEAC9 (light yellow)
manual highlight#A9D6FF (light blue)#2E5577 (dark blue)#ABD8FF (light blue)#2D5477 (dark blue)#ACD9FF (light blue)#33648F (dark blue)
textblackblack + whiteblackwhiteblackblack + white

Conclusions

  • All use essentially the same light and dark blue color for the manual highlight in light and dark mode.
  • The main problem seems to be with the target highlight and text color combinations in Safari in dark mode. This is the only technically inaccessible one.
  • The target highlight color for dark mode is the least consistent, with light mode coming in second.
  • The target highlight color for dark mode could be more like the manual highlight color, i.e. darker to improve the reading experience in dark mode.

Thoughts

  • We should probably keep the pattern of the blue manual highlight color as close to what it currently is as possible, just using an actual Codex color that most closely matches these very similar values.

Questions

  1. For the target highlight color, should we go with a pink (Chrome) or a yellow (Safari and Firefox) color? Our token value will of course come from the Codex color palette.
  2. Any ideas on the names of these tokens? background-color-text-highlight for the manual highlight and background-color-target-highlight for the target highlight? Something different?

cc @Catrope @Jdlrobson-WMF @JScherer-WMF

DTorsani-WMF renamed this task from Define Codex tokens for text-highight and target text to Define Codex tokens for text-highlight and target text.Wed, Nov 26, 1:36 AM
DTorsani-WMF triaged this task as Medium priority.
DTorsani-WMF moved this task from Backlog to In Progress on the Codex board.

In case helpful, I noticed that my Firefox and Chromium (both latest, on Linux Mint) are displaying different colors from your screenshots above. So I'd guess these are partially OS-defined/overriden colors? (However, I have previously selected a "dark grey" theme for my Mint OS configuration, so I'm likely not seeing the 'defaults')

image.png (353×892 px, 130 KB)
image.png (289×1 px, 131 KB)

@Quiddity thank you for this! Interesting to see for sure. It feels like these combinations could almost be anything depending on many different parameters. Maybe the best path forward is to choose a logical option that feels relatively common, uses Codex color tokens, and isn't likely to be similar to another use of color in this way, i.e. any of the upcoming diff themes, etc. I will put together a proposal.

Change #1216852 had a related patch set uploaded (by Dtorsani; author: Dtorsani):

[design/codex@main] token: Add NEW Background Highlight Target Text color token

https://gerrit.wikimedia.org/r/1216852

I've got a patch up, and a demo where you can see my proposal. My proposal is this:

  1. For now, we only customize the target text highlight, as this is the one that is more problematic and inconsistent.
    1. The most accessibility problems come in dark mode, when the highlight color is too light and the text remains white or when the highlight is too bright for dark mode.
    2. The selection text highlight is essentially the same blue across defaults which have not been customized or altered. For this reason, and because this one does not present any similar problems to the target text, let's not add a token for this/customize this.
  2. We use orange50 for the target text highlight color, for the following reasons.
    1. Orange is the chromatic opposite than blue (the selection text highlight color in most audited defaults).
    2. Orange is similar to yellow, one of the common defaults for target text highlights.
    3. Orange is not currently being used for any other sort of highlighting of text, such as in the planned diff style theme updates T394117: [EPIC] Diff styling.
    4. No matter what color we would use, the 50 value must be used to ensure proper 4.5:1 color contrast with any Codex text color token that is meant to be read, including all link colors, both visited and non-visited, in both light and dark modes.
  3. Based on 2B above, one might ask, "Then shouldn't we customize the selection text highlight color as well to ensure proper contrast?" At this time, we feel this is not necessary for the following reasons.
    1. Selection implies manual highlighting text that has already been read, and therefore does not necessarily, absolutely need to meet color contrast ratios when selected.
    2. This does not feel worth the change from the common default selection text highlight color to something then different from what people will see anywhere outside of any website using Codex.
  4. The token is named background-color-highlight-target-text.

@JScherer-WMF @Jdlrobson-WMF Can you please review this proposal and provide your thoughts? If we feel good about this, or once we do, then @Catrope can do the final review and merge this into Codex, ready to be used onwiki after the next Codex release.

@DTorsani-WMF in terms of tokens I think matching browser terminology is a good idea.

So for manual:

For target highlight:

I don't have any opinions around the colors. As long as they are accessible in dark mode I am happy (but FWIW if there's a hot pink option I would be very much for that).

I think I agree that maybe we don't need "highlight" in the token name. I think @Volker_E supports that as well.

Either way, in my proposal, we aren't customizing the selection color, and are going with orange for the reasons stated above.