-
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
Cover: Add typography supports #43298
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that adjusting these Typography controls also affects rendering in the placeholder state. This appears to happen in both the post editor at the individual block level, and when setting typography controls in global styles:
Post editor | Global Styles |
---|---|
I haven't looked closely, but I was wondering if we need to update the Edit component so that if it's in the placeholder state, we don't output the style rules? I imagine the global styles case might be trickier 🤔
Aside from the issue with the placeholder state, otherwise the controls are testing well for me in the post editor and global styles with #43300 applied 👍
I'm wondering if we'll need a solution for placeholders in general. Any block using a placeholder and typography supports (among others e.g. border) will suffer the same issue. Borders might be a special case, as for the Post Featured Image within a Query Loop in the site editor, there's a case to be made for displaying the border around the placeholder. |
It's an issue that has been around for a while. After a quick look I found these issues:
I remember also briefly discussing it with @ajlende in an issue/PR. It's a difficult one to solve. Probably two ways to go about it. Either not show particular block tools when the placeholder is visible, or try to prevent the styles from affecting the placeholder (popover/iframe/shadow dom). The problem with the latter option is that some styles need to be let through (otherwise something like this would be easy - https://matthewjamestaylor.com/style-blocker). One idea might be to add a context provider around blocks that stores state around whether block supports features are visible/enabled. Then each placeholder could disable design tools when mounting, but enable when unmounting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected!
Given we'll look for a holistic solution to block placeholders inheriting the typography styles, I'll merge this one and follow-up on that separately. |
Depends on:
Related:
What?
Adds typography support to the Cover block.
Why?
How?
Testing Instructions
Screenshots or screencast
Screen.Recording.2022-08-17.at.3.49.26.pm.mp4