-
Notifications
You must be signed in to change notification settings - Fork 798
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
Custom CSS: add deprecation warning for Start Fresh option #37193
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
@@ -30,6 +30,7 @@ public static function add_hooks() { | |||
add_action( 'load-revision.php', array( __CLASS__, 'load_revision_php' ) ); | |||
|
|||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'wp_enqueue_scripts' ) ); | |||
add_action( 'admin_footer', array( __CLASS__, 'update_initial_state' ) ); |
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 don't know if that's the most appropriate hook to use. Let me know if there's a more suited one.
*/ | ||
public static function update_initial_state() { | ||
$start_fresh = null; | ||
// $wp_customize is not available here. Let's get the value of the `replace` option from the last |
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.
Since $wp_customize
is unavailable here, I had to go with a more imperative approach to fetch the value of the Start Fresh option. Let me know if there's a better alternative.
'react-plugin', | ||
" | ||
try { | ||
var options = window.Initial_State?.getModules?.['custom-css']?.options || {}; |
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.
This seems the most straightforward way to make the value of the Start Fresh option available to client pages (the Customizer case is handled separately).
i: <i />, | ||
b: <b />, | ||
a1: <CustomizerLink siteAdminUrl={ siteAdminUrl } />, | ||
a2: <a href="https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/" />, |
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.
As it's an external link, should this open in a new tab instead, with rel="noopener noreferrer"
and target="_blank"
?
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.
Maybe we could rely on ExternalLink
here, to handle both the display and the markup at once?
'contentWidth' => $content_help, | ||
'revisions' => _x( 'See full history', 'Toolbar button to see full CSS revision history', 'jetpack' ), | ||
'css_help_title' => _x( 'Help', 'Toolbar button to get help with custom CSS', 'jetpack' ), | ||
'startFreshCustomizerWarning' => __( "The Start Fresh option in the Additional CSS panel is enabled, which means the theme's original CSS is not applied. This option will no longer be supported.", 'jetpack' ), |
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.
With this, along with StartFreshDeprecationWarning
, I wonder if we may need design/marketing input on the wording itself here? The part I am stumbling on in particular is 'This option will no longer be supported.' - I wonder if we need to allude to a sense of urgency even if not giving a date.
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.
Yes, I came here to suggest the same thing. I think we need a date for it to be really useful. I would recommend giving a date matching the July or August monthly release (first Tuesday of the month) to give folks time to make the changes.
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.
Building on @coder-karen 's comment about wording and timing, I think it may be worth asking folks on Jetpack Design for their input on wording and the best combination of messages to ensure folks understand:
- How and when the Custom CSS feature is going away
- What that means for them
- If they have to take action (i.e. if they use the start fresh), what they should do.
It may be worth p2'ing this on their p2 to get their full input on it maybe, so they can work on the different possible flows?
@@ -724,6 +731,8 @@ public static function customize_register( $wp_customize ) { | |||
} | |||
} | |||
|
|||
$deprecated_suffix = ' (' . __( 'deprecated', 'jetpack' ) . ')'; |
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 think it may be best to edit the strings directly to add "(deprecated)". It will make easier for translators to provide meaningful, since not all languages would use this "term (deprecated)" format in the first place (RTL languages come to mind).
Yes, that will mean the strings will become untranslated for a bit, but I think it would still be a better experience in the end.
/** | ||
* Update the initial state to include the `replace` option (Start Fresh) in the module data. | ||
*/ | ||
public static function update_initial_state() { |
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.
Since this is only meant to be useful in the Jetpack dashboard, I think we should limit it to that page. We don't want to run a posts query on dashboard pages where it won't be used.
Hooking into admin_enqueue_scripts
instead of admin_footer
should give you more control there.
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.
admin_enqueue_scripts
won't work: the call to wp_add_inline_script
in the callback will fail. But I could check the current page and bail out early if it's not the Jetpack dashboard.
'contentWidth' => $content_help, | ||
'revisions' => _x( 'See full history', 'Toolbar button to see full CSS revision history', 'jetpack' ), | ||
'css_help_title' => _x( 'Help', 'Toolbar button to get help with custom CSS', 'jetpack' ), | ||
'startFreshCustomizerWarning' => __( "The Start Fresh option in the Additional CSS panel is enabled, which means the theme's original CSS is not applied. This option will no longer be supported.", 'jetpack' ), |
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.
Yes, I came here to suggest the same thing. I think we need a date for it to be really useful. I would recommend giving a date matching the July or August monthly release (first Tuesday of the month) to give folks time to make the changes.
5b038c8
to
82fca2d
Compare
I've updated the link the notices, and added a notice in the frontend. I've updated the instructions accordingly. |
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.
On self hosted this looks good :)
As for an Atomic test site though (WoA dev site using rsync, and regular AT site using the beta tester plugin), I noticed that the dashboard notices weren't showing up. After digging a bit further, that appears to be because this.props.startFreshEnabled
returns false when it should be true.
If this is replicable I think personally we'd want notices to display on the dashboard for Atomic sites as well, if it's possible.
Thanks @coder-karen!
Interesting. I haven't been able to reproduce the issue on a regular AT site. Did you hit the Publish button in the Customizer after checking the option? As for WoA sites, they shouldn't be impacted by this PR since they load their own plugin instead of the Jetpack module. |
82fca2d
to
39e9f61
Compare
a756659
to
bcf4250
Compare
Instructions updated. PR's ready for review. |
…-customizer-css.core-4.9.js Co-authored-by: Karen Attfield <karenlattfield@gmail.com>
7c6ff0f
to
7651571
Compare
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 well, looks great 👍
Proposed changes:
The Custom CSS feature will soon be deprecated from Jetpack.
In this PR, we're adding warnings for sites with the Start Fresh option enabled. Since this option prevents the site from loading the theme CSS, removing it will likely break the site design.
Site admins must take action, so these warnings must be visible. We've added them in 4 different places:
Simple and atomic sites are not concerned by this.
Other information:
Jetpack product discussion
pfwV0U-4M-p2
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
Prerequisites
/wp-admin/admin.php?page=jetpack#/settings?term=css
/wp-admin/customize.php?autofocus%5Bsection%5D=custom_css
Notices
/wp-admin/admin.php?page=jetpack#/settings?term=css