text-shadow option support in Typography Panel#71419
Conversation
text-shadow option support in Typography Panel
text-shadow option support in Typography Paneltext-shadow option support in Typography Panel
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @HatlerRyan, @UltimateByte, @burnuser. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks @USERSATOSHI for the PR! Reviewed it on Playground in Brave (Chromium). Reviewing as a designer, apologies if I use any technical terms wrong.
Also, with the current implementation it's not possible to add multiple shadows, which I think would be a great enhancement. Let's start by enabling one first though. |
|
Hi, Seems like I won't be having bandwidth till Friday, so I will tackle this on 3 Oct if that's fine |
|
I would greatly prefer this use off-the-shelf presets similar to |
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Thanks for all the hard work here @USERSATOSHI 💪
After taking this for a bit of a spin, there are a few things I'd like to flag.
- For new block supports it is best to land them under a stable block support key. In other words, we're avoiding introducing new supports with the
__experimentalprefix - The Style Engine requires a definition for the text shadow support in its PHP config or it will not generate styles for dynamic blocks. Check out the text decoration support for and example to follow
- The TextShadowControl UI probably needs some refinement before we can proceed here
- The "enable text shadow" checkbox is probably overkill. If the control is being displayed via the ToolsPanel menu, that might be enough to determine a text shadow should be applied
- The standard layout for Input and Slider combos in the sidebar is Input first.
- The reset buttons on each Input/Slider combo is overkill, especially when the whole control can be reset via the ToolsPanel menu
- There's a UX quirk where if you hit the reset button on all the text shadow inner controls you suddenly get the "enable text shadow" checkbox unchecked due to the empty text shadow value even though you're actively making changes to the shadow
- I think I agree with Cory that for this block support it would be better to leverage shadow presets. I don't hold a strong opinion though as to whether it should share the same presets as the box shadow support or if it needs its own.
Also, I feel like we'd be best served by combining this and #73320 (cc/ @t-hamano) to make sure the block supports and global styles are all covered fully and interacting correctly.
| const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; | ||
| const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; | ||
| const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration'; | ||
| const TEXT_SHADOW_SUPPORT_KEY = 'typography.__experimentalTextShadow'; |
There was a problem hiding this comment.
In recent times, we've avoided landing more __experimental block supports. Once they are in a release they tend to get used and we have to provide backward compatibility anyway. It's easiest to just land new supports as stable.
| const TEXT_SHADOW_SUPPORT_KEY = 'typography.__experimentalTextShadow'; | |
| const TEXT_SHADOW_SUPPORT_KEY = 'typography.textShadow'; |
|
I’m closing this for now so we can focus on discussing the design and then break the work into smaller PRs. |
What?
Closes #47904
This PR adds text shadow support to the typography panel in the block editor.
Why?
Currently, the
text-shadowCSS property is not directly editable for blocks from the Gutenberg typography panel, making it difficult to add shadow effects to text elements without custom CSS.This PR aims to solve this by adding a
Text Shadowcontrol to the typography panel, allowing users to configure text shadows with full control over horizontal offset, vertical offset, blur radius, and shadow color.This can be useful when users want to:
How?
This PR addresses this issue by adding a
TextShadowControlcomponent to the Typography Panel. The implementation includes:Testing Instructions
Screenshots or screencast
Screen.Recording.2025-08-29.at.11.50.09.PM.mov