GlobalStylesUI: Add reset action to Additional CSS screen#77670
GlobalStylesUI: Add reset action to Additional CSS screen#77670
Conversation
| "@wordpress/icons": "file:../icons", | ||
| "@wordpress/keycodes": "file:../keycodes", | ||
| "@wordpress/private-apis": "file:../private-apis", | ||
| "@wordpress/ui": "file:../ui", |
There was a problem hiding this comment.
This is a starting point for introducing a new Stack component to replace VStack and HStack.
See: #76222
|
Size Change: +314 B (0%) Total Size: 7.82 MB 📦 View Changed
ℹ️ View Unchanged
|
|
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 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. |
|
Flaky tests detected in fa53391. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25042425460
|
Provide a way for users to clear custom CSS from the Additional CSS screen via an options menu, mirroring reset affordances elsewhere in Global Styles.
… theme default Previously the Reset action was disabled whenever user CSS was empty, which prevented restoring the theme default after the user had cleared the editor to an empty string. Compare the effective (merged) CSS against the base (theme) CSS so Reset is available whenever they diverge.
The previous commit started importing from @wordpress/ui but did not declare it as a project reference, causing lint:tsconfig to fail.
Replaces PanelBody with ToolsPanel/ToolsPanelItem in the per-block screen so the Additional CSS field exposes a reset action consistent with the global Additional CSS screen. Reset is enabled whenever the merged CSS differs from the theme default, allowing users to revert an empty override back to a theme-provided default. Also defaults the AdvancedPanel textarea value to an empty string so the input stays controlled when CSS resets to undefined; otherwise the textarea visually retains the previous text until reload.
c5e718e to
fa53391
Compare
Closes #60673
What?
Adds a "Reset" action to the Additional CSS screen in the Global Styles UI.
Why?
Users can freely modify additional CSS, but if they want to restore the default values provided by the theme, they need to reset all global styles.
How?
Root
Add a dropdown to the right of the screen header.
This is similar to the font size presets and shadow presets.
Per Block
Refactor the Advanced panel using the
ToolsPanelcomponent. Note that this will only be effective in global styles and will not affect the block's sidebar within the post content.Testing Instructions
Screenshots or screencast
Root
Recording.2026-04-25.203744.mp4
Per Block
Recording.2026-04-26.000402.mp4
Use of AI Tools
Used Claude Code to help draft the implementation and this PR description. All changes were reviewed before submission.