-
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
Blocks text placeholder may have insufficient color contrast depending on the active theme #60275
Comments
Note: there is a scss mixin that styles the placeholder attribute but it is only used for some inputs of the editor interface. It's not used for the blocks placeholder. |
While working on this, I noticed the CSS class |
After some research in the project history, I found some related argumentations in #33058, specifically:
I don't think the text placeholder within the editor canvas should match the colors set by the theme or customized by the user. The text placeholders aren't part of the site preview. Instead, they are part of the user interface, whether they are placeholder of input elements or the placeholder of the RichText component. As such, text placeholders in the canvas must always be readable, whatever the background color is. Their color must be set by the editor. Of course, this should not affect text placeholders in other parts of the editor UI, e.g. sidebars, panels, popovers, etc. One special case that exposes a similar issue is the Cover block. The block detects the color of the image overlay or background color and dynamically changes the text placeholder and also the default cover text color. But, when users set a custom text color, it is set also on the text placeholder. This shouldn't happen because the text placeholder may become unreadable. Instead, an editable input placeholder should always be visible. Animated GIF to illustrate: |
Note to myself: |
Hey @afercia, I have a PR - #69312 that removes the I see your changes here in #69333 also partly remove the So I think we should either ship #69312 first and then proceed with your changes or incorporate all the changes in any one of the PR since the changes are almost similar. This way I think we can avoid conflicts and streamline the approach better. What do you think? |
@himanshupathak95 I would say to merge your #69312 first as it's simpleer and self-contained. I'll then rebase my PR, no rpoblems. |
One more finding is about the opacity for the caption placeholder:
It uses this selector: to increase the opacity for the captions. However, I'm not sure that has ever worked because the placeholder text uses Also, I would argue that the reasoning that the caption placeholder needed some higher opacity to be better readable, that is valid for all placeholders of all blocks so that at the very least I'd propose to increase the opacity value for the default placeholder to |
Description
Some blocks display a placeholder text.
In all cases, the placeholder text must meet the color contrast ratio requirement of 4.5:1. It is part of the user interface so that the editor must make sure it is readable for everyone.
Turns out the color of the text placeholder may inherit from the active theme.
For the RichText, the editor CSS sets a CSS
opacity: .62;
regardless.Setting that opacity doesn't seem to be ideal. When the active theme uses a light color, the opacity set by the editor may bring the contrast ratio below the required threshold. This is the case with Twenty Twenty-Four, for example.
Iin the screenshot below, I'm comparing some block text placeholder in the editor. On the left, with Twenty Twenty-Three active and on the right with Twenty Twenty-Four active.
Observe the color of some of the placeholders actually changes depending on the theme and it has insufficient contrast.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
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
The text was updated successfully, but these errors were encountered: