-
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
Group: Add support for shadows #62258
Comments
This morning, I was thinking about this and planned to create an issue. Thank you, @noisysocks, for addressing it first. While I understand there are some considerations when adding style support to the Group block, we need to work through them. The Group block is likely the most popular block for using the shadow style. For instance, if this support is implemented, I could remove three block styles from my Powder theme: https://github.com/bgardner/powder/blob/main/functions.php#L60-L64. |
I found this issue while trying to figure out how to add a shadow to a group. This would be a great feature to have for designing cards within a grid layout. |
We definitely need to get this resolved for 6.7, as it's one of the first blocks you'd expect to be able to add shadow to. If anyone wants to enable this manually in a theme for testing purposes, you can use the following code: function addShadowSupport( settings, name ) {
// Bail early if the block does not have supports.
if ( ! settings?.supports ) {
return settings;
}
// Only apply to Group blocks.
if ( name === 'core/group' ) {
return Object.assign( {}, settings, {
supports: Object.assign( settings.supports, {
shadow: true,
} ),
} );
}
return settings;
}
wp.hooks.addFilter(
'blocks.registerBlockType',
'modify-block-supports/add-shadow-support',
addShadowSupport,
); |
I agree. Adding shadow can be a complex action. For edge cases, like two shadowed groups next to one another, it requires some understanding of CSS, much like negative margin does. I think this is fine and we should not be automatically applying any additional styling when a shadow is added. I have already added shadow manually in all my projects, and it works as expected. I recommend we add shadow to Group as soon as possible and let folks experiment with it. |
While creating a block theme yesterday I hit a wall when trying to add a drop shadow to my header. I was surprised to learn that you can't currently set a Shadow on Group, Row, Stack or Grid blocks.
I searched around and can see that Group was an item in #57103 but it was left out of #57982 as it needed more testing. Not sure if there's been any update since then? cc. @madhusudhand @vcanales
The text was updated successfully, but these errors were encountered: