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

No background on Cover block creates a11y issue #65868

Open
2 tasks done
troychaplin opened this issue Oct 4, 2024 · 2 comments
Open
2 tasks done

No background on Cover block creates a11y issue #65868

troychaplin opened this issue Oct 4, 2024 · 2 comments
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image

Comments

@troychaplin
Copy link
Contributor

troychaplin commented Oct 4, 2024

Description

When adding a cover block and using light coloured text and a low opacity, the lack of background colour on the primary block wrapper leads to an a11y error. Currently the opacity is what appears influence a pass of a fail.

Suggested solution:

  • add background color option to cover block and set it to #111111 by default when block is placed on page.

Step-by-step reproduction instructions

I have two ways to easily create a contrast error, both tested in 6.7 and the latest trunk of TT5 as of an hour ago. Both approaches were tested with HTML_CodeSniffer and Firefox Dev Edition and the Wave Accessibility Extension.

Approach 1:

  • add cover block
  • set opacity to 60

Approach 2:

  • add cover block
  • use dark image
  • remove opacity
  • use white (or bright yellow) text

In both cases using the inspector adding a background of black to the main cover div fixes the issue.

Screenshots, screen recording, code snippet

Image
Image
Image
Image

Environment info

  • WP 6.7, Gutenberg 19.3.0, TwentyTwentyFive lastest trunk as of Oct 3rd @ 10pm EST
  • Impacts all browsers
  • Is not system specific

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@troychaplin troychaplin added the [Type] Bug An existing feature does not function as intended label Oct 4, 2024
@colorful-tones colorful-tones changed the title No background on cover block creates a11y issue No background on Cover block creates a11y issue Oct 4, 2024
@colorful-tones colorful-tones added the [Block] Cover Affects the Cover Block - used to display content laid over a background image label Oct 4, 2024
@carolinan
Copy link
Contributor

I believe this is a duplicate of #39692?

@richtabor
Copy link
Member

richtabor commented Nov 6, 2024

It's worth noting that this is dependent on the theme's background color (or the background color of the element the cover block is placed in. It's not possible to account for all variations and setting a fixed background color for the default state of cover block would not be an appropriate solution.

For resetting, there's a bit more of a path. Perhaps when resetting the image (removing it), the overlay value is set higher to engage the light/dark contrast, say 70.

Image
Image

@richtabor richtabor removed the [Type] Bug An existing feature does not function as intended label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image
Projects
None yet
Development

No branches or pull requests

5 participants