-
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
Disable the "Reset styles" button when there are no changes. #63495
Comments
Thanks for the report. If the global styles hasn't changed, or if you've reset the global styles once, the button should be disabled. However, for some reason the gutenberg/packages/block-editor/src/components/global-styles/hooks.js Lines 87 to 94 in 48b8350
The reason for this might be that even if the global styles hasn't changed, the two configs are different, so
|
After some quick investigation, it appears that the newly added
|
A simple fix would be to rewrite the diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js
index 44a3d5e23e..81e57ca5dc 100644
--- a/packages/block-editor/src/components/global-styles/hooks.js
+++ b/packages/block-editor/src/components/global-styles/hooks.js
@@ -85,7 +85,11 @@ const VALID_SETTINGS = [
];
export const useGlobalStylesReset = () => {
- const { user: config, setUserConfig } = useContext( GlobalStylesContext );
+ const { user: _config, setUserConfig } = useContext( GlobalStylesContext );
+ const config = {
+ settings: _config.settings,
+ styles: _config.styles,
+ };
const canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );
return [
canReset, |
@t-hamano ignoring |
Fixed by #63562 |
What problem does this address?
I've just did a styles reset and noticed the "Reset styles" button is still enabled.
It let me reset again and It still says there's 1 site change to be saved.
Makes zero sense to me. And I find this behavior very confusing for the end user.
It goes against the user to properly identify when the styles are truly reset.
It requires you to remember if you've reset them.
What is your proposed solution?
If the Global Styles are reset. The "Reset styles" button should be disabled.
Note that I've used the DevTools to make the text look Greyish (disabled).
The text was updated successfully, but these errors were encountered: