-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site editor: show color warning if poor contrast colors are picked #29457
Comments
Hello ) I think I can fix this ) |
@nosolosw perhaps you can share some insight? If not, no worries :) |
Thanks for looking into this @Quintis1212 ! I took a quick look at this and I was able to reproduce with any block that uses the color panel we provide (for example, paragraph). Apparently, the post editor and the site editor use the same mechanism (this), so I'm not sure why the color contrast notice doesn't work for the site editor off the top of my head. Would that link be helpful to start to tracking things down, @Quintis1212? |
Thank you for help @nosolosw ! I wil continue to fix this bug with help of your info ) |
@nosolosw I finded out that there is a function which works incorrect : ` This function can not find element in site editor which must be checked by contrast : |
Ah, I see. The color contrast feature uses the DOM to find the block node. However, this is problematic here because the editor canvas and the sidebar live in different documents (the editor is iframed) ― that's why the colorsDetectionElement is never found here but it is in the post editor. Does this provide any help to continue investigating the fix? I'm going to pull @ellatrix thoughts on this as well. |
I've taken the liberty of exchanging "Site Title" for "Site Editor" from the issue title and the label, as I think it reflects the issue is wider and affects all blocks. |
I had another ticket for this on #28782 (for global styles), closed as a duplicate. |
@nosolosw It seems we need to use refs for detecting elements colors , I can not save document object in local storage
` path : gutenberg/packages/block-editor/src/utils/dom.js
` Any ideas ?) |
@nosolosw I remember seeing some refactors to swap Thinking through my previous Maybe something like this could work? I'm just spitballing ideas :). I don't mean to step on anyone's toes if they're already working on a solution! |
Looking into this |
Description
If you select a color for the site title that results in poor contrast, no notice is given. This is feedback from the FSE Outreach Program's second call for testing.
Step-by-step reproduction instructions
Please list the steps needed to reproduce the bug. For example:
Expected behaviour
I expect a notice about poor contrast similar to what happens when you do so in the post/page editor:
Actual behaviour
No warning given.
Screenshots or screen recording (optional)
contrast.warning.mov
WordPress information
The text was updated successfully, but these errors were encountered: