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

Allow checking contrast at AAA level with contrast-checker #31223

Open
danielck opened this issue Apr 27, 2021 · 1 comment
Open

Allow checking contrast at AAA level with contrast-checker #31223

danielck opened this issue Apr 27, 2021 · 1 comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@danielck
Copy link

What problem does this address?

The current contrast-checker component in core uses the tinycolor library to check the contrast between two colour values. The specific isReadable method used by contrast-checker supports both level AA and AAA, but currently level AA is hard-coded into the WP component:

		tinycolor.isReadable( tinyBackgroundColor, tinyTextColor, {
			level: 'AA',
			size:
				isLargeText || ( isLargeText !== false && fontSize >= 24 )
					? 'large'
					: 'small',
		} )

This means that for site owners or developers wishing to enforce criterion 1.4.6 Contrast (enhanced), doing so would require developing a custom component.

What is your proposed solution?

Level AA is a very good default and I do not propose changing this. However, adding a JS or PHP filter for the level would at least allow developers to change the level relatively easily.

@aristath aristath added [a11y] Color Contrast [Type] Enhancement A suggestion for improvement. labels Apr 27, 2021
@aristath
Copy link
Member

Nice suggestion. Marked as a feature-request for the color-contrast checker 👍

@skorasaurus skorasaurus added [Status] In Progress Tracking issues with work in progress [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). and removed [a11y] Color Contrast labels Jul 20, 2023
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). [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants