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

Input placeholder text must have a sufficient color contrast ratio #9502

Closed
afercia opened this issue Aug 31, 2018 · 1 comment · Fixed by #9562
Closed

Input placeholder text must have a sufficient color contrast ratio #9502

afercia opened this issue Aug 31, 2018 · 1 comment · Fixed by #9562
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@afercia
Copy link
Contributor

afercia commented Aug 31, 2018

In 44c9c20 (see #1302 / #1439) the placeholder text color was changed to have a sufficient color contrast ratio to meet the WCAG level AA requirement.

It used the color $dark-gray-300: #6c7781 which is the lightest gray in the colors palette that can be used against a white background to meet the WCAG requirement.

Following changes, see for example af65418 in #6406 and 0addd84 in #6937 have modified the placeholder color; it now uses also some alpha transparency and it's rgba(34, 52, 67, 0.5).

The resulting color contrast ratio against a white background is a very low 2.86:1. It must be at least 4.5:1. See https://jdlsn.com/color/?type=rgb&color=34,52,67&color2=255,255,255&alpha=0.5

I'm a bit surprised these changes have been made without any mention to accessibility or without properly labelling the related issues and PRs, as the first color change to #6c7781 was specifically made, and agreed, to address an accessibility issue.

Regardless, these colors must be changed to whatever color is desired, as long as the resulting contrast ratio is 4.5:1.

Worth also noting this is what core does, and Gutenberg shouldn't deviate from accessibility best practices that have been established in core. See https://core.trac.wordpress.org/browser/trunk/src/wp-admin/css/forms.css?rev=43309&marks=226-237#L225

/Cc @jasmussen

@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Regression Related to a regression in the latest release labels Aug 31, 2018
@afercia
Copy link
Contributor Author

afercia commented Sep 1, 2018

To clarify, this is not about the RichText component fake "placeholder" which should be reviewed separately (it doesn't have a sufficient color contrast as well).

Instead, it's about real HTML placeholder attributes used for real input or textarea elements. Some blocks use standard input elements and custom blocks may use them as well. In these cases, the placeholder color is too light:

embed:

screen shot 2018-09-01 at 12 41 24

shortcode:

screen shot 2018-09-01 at 12 47 16

custom block:

screen shot 2018-09-01 at 13 03 50

Worth noting this is also inconsistent because other input fields outside of the block list use the placeholder color inherited from core forms.css which is #72777c (with a good color contrast). See for example the inserter search field or some fields in the sidebar:

screen shot 2018-09-01 at 12 50 42

screen shot 2018-09-01 at 12 44 49

screen shot 2018-09-01 at 12 45 32

I'd also like to remind that checking color contrast in Chrome is very easy. Also placeholder can be checked, revealing in the inspector the shadow DOM. Added bonus: the Chrome color checker takes into account also alpha transparency:

screen shot 2018-09-01 at 13 07 45

jasmussen added a commit that referenced this issue Sep 3, 2018
This fixes #9502 and fixes #9532.
jasmussen added a commit that referenced this issue Sep 10, 2018
This fixes #9502 and fixes #9532.
jasmussen added a commit that referenced this issue Sep 11, 2018
This fixes #9502 and fixes #9532.
jasmussen added a commit that referenced this issue Sep 14, 2018
* Fix placeholder contrast.

This fixes #9502 and fixes #9532.

* Fix caption placeholder styles.

This fixes the caption styles for images (and embeds and anything else that has external captions), as well as for gallery items which has placeholder text overlaid. The overlay placeholder text has about a 4.8 average contrast ratio with the text on a scrim over a light image. This will vary a bit based on the darkness of the image.
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] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants