-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Colour contrast checker fails on nested blocks #13862
Comments
Related: #14687 Can confirm this is a bug:
We probably need to make the colour contrast checker smart enough to know what the background colour is when no explicit Background Colour setting is set. It’s either going to be the background colour of the parent block or the background colour of the post. We could maybe look at using React Context for this. |
The recent changes to the Group colour options seem to have fixed this in the group context at least: |
The cover block is too opinionated - particularly where it then contains buttons > button. Because it changes the color to #fff which is not accessible for lightly colored backgrounds. I propose that trying to 'force' the contrast is too opinionated. This should be left to the user to decide. Imagine the common design pattern of having a buttons block with a higher priority button and a lower priority button in the same block...one is likely lightly colored background and the other is dark...but the a:visited property is set to #fff which cannot be easily changed by either the user or the theme developer. |
If a background colour is set on a parent block (e.g Media & Text) and then a text colour set on a child block (e.g a paragraph) resulting in poor contrast a warning is not shown.
Equally setting a background colour on a parent block does not show a poor contrast warning if a child block without it's own colour settings (e.g. a heading block) results in poor contrast.
I understand this is an issue to do with a paragraph having a transparent background making it impossible to compute a contrast. In this thread (#5658 (comment)) it was suggested it might be possible to recurse through blocks, but it wasn't pursued at the time; maybe it's time to revisit? I think this could at least work in the case where a background is set on a parent block, and the check recurses down through child blocks checking the text colour.
The text was updated successfully, but these errors were encountered: