Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient color contrast for calendar selected date and Publish button #15278

Closed
karlgroves opened this issue Apr 30, 2019 · 16 comments
Closed
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.

Comments

@karlgroves
Copy link

Insufficient color contrast for calendar selected date and Publish button

  • Severity: Medium
  • Affected Populations:
    • Low-Vision
    • Cognitively Impaired
  • Platform(s):
    • All / Universal
  • Components affected:
    • Document Panel
    • Publish and Unpublish

Issue description

The selected date within the calendar, and the "Publish" button, have
insufficient color contrast, below the minimum threshold of 4.5:1 for
text:

  • "Publish" button: #fff (white) on #0085ba (blue): 4.15:1
  • Selected date within the calendar: #fff (white) on #0085ba (blue): 4.15:1

Sufficient color contrast is important for users who have low-vision or
are color-blind, because text with a low contrast ratio may be difficult
or impossible for such users to see.

Issue Code
    /* selected calendar date */
    .components-datetime__date .CalendarDay__selected {
        background: #0085ba;
    }

    .CalendarDay__selected,
    .CalendarDay__selected:active,
    .CalendarDay__selected:hover {
        ...
        color: #fff;
    }


    /* Publish button */
    .components-button.is-primary {
        background: #0085ba;
         ...
        color: #fff;
    }

Remediation Guidance

Darken the background color to achieve a minimum contrast of 4.5:1.

Recommended Code
    /* selected calendar date */
    .components-datetime__date .CalendarDay__selected {
        background: #006a95;
    }

    .CalendarDay__selected,
    .CalendarDay__selected:active,
    .CalendarDay__selected:hover {
        ...
        color: #fff;
    }

    /* Publish button */
    .components-button.is-primary {
        background: #006a95;
         ...
        color: #fff;
    }

Relevant standards

Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-19 in Tenon's report

@gziolo gziolo added the Needs Accessibility Feedback Need input from accessibility label Apr 30, 2019
@mapk
Copy link
Contributor

mapk commented May 2, 2019

Thanks. This appears to be the standard WordPress primary button styles across the board, not just Gutenberg.

Here's the conversation on this in Core Trac. https://core.trac.wordpress.org/ticket/31459

I'd like to get Accessibility Team's input on this. @afercia @LukePettway

Examples of this same button used elsewhere:

w.org header
Screen Shot 2019-05-01 at 6 28 17 PM

Download page on w.org
Screen Shot 2019-05-01 at 6 28 52 PM

Login page
Screen Shot 2019-05-01 at 6 29 33 PM

@afercia
Copy link
Contributor

afercia commented May 2, 2019

Publish button (and all the primary blue buttons in WordPress):
Yes, they were previously discussed in https://core.trac.wordpress.org/ticket/31459. In order to not touch the color palette, we opted to add a subtle text-shadow around the white text to increase the perceived contrast. See https://core.trac.wordpress.org/changeset/34948

This technique is explicitly mentioned in https://www.w3.org/TR/WCAG20-TECHS/G18.html. However, it's a compromise and the best option would be to just darken the #0085ba blue. This part should be reported on the core Trac.

Selected date within the calendar
(and all the other controls in Gutenberg that use a #0085ba background without the text-shadow technique) Contrast is insufficient. I'd say it's one more good reason to just darken the #0085ba blue, as the text-shadow technique can be easily overlooked and can be undesirable on some elements.

@afercia afercia added [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked. [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [a11y] Color Contrast and removed Needs Accessibility Feedback Need input from accessibility labels May 2, 2019
@mapk
Copy link
Contributor

mapk commented May 2, 2019

Just for reference, the selected date within the calendar looks like this:

Screen Shot 2019-05-02 at 9 15 45 AM

@melchoyce
Copy link
Contributor

The next color up in our color chart that passes contrast is #307bad, which has a contrast ratio of 4.6:

image
image

That would also allow us to remove that text shadow, which would be nice.

@mapk
Copy link
Contributor

mapk commented May 2, 2019

Alrighty, as mentioned in the triage slack chat, let's break out the primary button issue into a Core Trac issue and work on the calendar date highlight in Gutenberg.

@sarahmonster
Copy link
Member

Note: currently that #307bad isn't available as a colour in Gutenberg's palette of blues:

Screenshot 2019-05-02 at 11 43 01

https://github.com/WordPress/gutenberg/blob/c2c8276ac8e89af8382d5180ffa6a52f7fa3f98e/assets/stylesheets/_colors.scss

We might want to review how blues are being used in an attempt to scale down the number of different shades in use.

@afercia
Copy link
Contributor

afercia commented May 2, 2019

Ideally, the WordPress palette and the Gutenberg palette should be unified, in an effort to get the best of both worlds. I don't see great value in keeping two separate sets of colors, especially in terms of maintenance and consistency.

@sarahmonster
Copy link
Member

Agreed! I'd really love to see our palette unified and pared down a wee bit.

@afercia
Copy link
Contributor

afercia commented May 2, 2019

Glad to hear there's consensus! That's definitely a job for designers. I'd expect from the design team to open a Trac ticket and lead the effort to unify the two palettes 🙂

@afercia
Copy link
Contributor

afercia commented May 8, 2019

Note for triage: only one part of this issue should be moved to core Trac. Please keep this issue open.

@afercia
Copy link
Contributor

afercia commented May 10, 2019

Note 2: the Publish button was fixed in #15544. The Calendar selected date still needs improvements.

@afercia
Copy link
Contributor

afercia commented May 10, 2019

As mentioned in #15432 (comment) here's the relevant core Trac tickets:

The design of the focus outline on buttons/elements could be improved
https://core.trac.wordpress.org/ticket/34904
With some design proposals from @MichaelArestad

a11y-focus: Standardizing the handling of :focus and :hover
https://core.trac.wordpress.org/ticket/34957

So maybe there's no need to move the first part of this issue to Trac, as there are already tickets about it.

@joyously
Copy link

This issue should be closed by removing all opinionated styles from the calendar block. (and all blocks!)
There is text color, background color, padding, width of 100%, link color.

Here is what the block styles produce on the front end:
calendar-block-on-dark

and here is how my theme styles it without any additional specific styling (I just removed the wp-block-calendar class using Dev Tools):
theme-calendar-block-on-dark

@tellthemachines
Copy link
Contributor

Current status of this ticket:

As soon as that last item is done, it should be safe to close this issue, or have I missed anything?

@joedolson
Copy link
Contributor

I haven't been able to trace exactly where it changes, but in looking at the current color contrast for the selected date, the color is now rendering as #007cba, which passes contrast tests at 4.57:1 (https://jdlsn.com/color/?type=hex&color=FFFFFF&color2=007cba). I think that means that this issue can now be closed.

@mapk
Copy link
Contributor

mapk commented Jul 24, 2020

I think you're right, @joedolson. Here's a screenshot of the current state.

Screen Shot 2020-07-24 at 1 03 36 PM

I'll close it out. Thanks everyone!

@mapk mapk closed this as completed Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] WP Core Ticket Requires an upstream change from WordPress. Core Trac ticket should be linked.
Projects
None yet
Development

No branches or pull requests

10 participants