-
Notifications
You must be signed in to change notification settings - Fork 814
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
Carousel: disable WordPress Core' Lightbox option #36565
Conversation
Fixes #32668 It's best to keep only one lightbox option, to avoid any confusion. Since Jetpack's Carousel feature currently offers more features, let's keep ours in favor of Core's for now. In the future, when core's lightbox option becomes more robust, we can consider deprecating Jetpack's Carousel feature altogether.
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?
|
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 as advertised.
@david-binda I'd like to have your opinion on this. What would be the best way for me to solve this problem? In short, this PR makes changes to themes' configuration when the Carousel feature is enabled. Since it is always enabled on WordPress.com Simple, it causes the unit tests to fail (more precisely, the diff --git a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php
index cac86b3a6d..5a8e1180fe 100644
--- a/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php
+++ b/projects/plugins/jetpack/modules/carousel/jetpack-carousel.php
@@ -218,6 +218,11 @@ class Jetpack_Carousel {
* @param WP_Theme_JSON_Data $theme_json Class to access and update theme.json data.
*/
public function disable_core_lightbox( $theme_json ) {
+ // Do not customize the theme configuration in unit tests.
+ if ( defined( 'TEST_REQUEST' ) && TEST_REQUEST ) {
+ return $theme_json;
+ }
+
return $theme_json->update_with(
array(
'version' => 2, Thank you! |
Could it the tests in question be adjusted to reflect that? IMHO, it's bette to adjust the tests accordingly rather than disabling the feature when tests are run, as the tests should reflect the code run in production. |
Merging this now. The WordPress.com tests will need to be updated to match that change:
|
@jeherve what will happen on sites where customers have intentionally activated core lightbox on specific images or via global styles? |
@liviopv Existing images should not be impacted, but you won't be able to add the core lightbox to new image blocks you add (unless you go and deactivate the Carousel feature in Jetpack > Settings). |
Thank you for working on this fix!. Question: will this affect self-hosted sites too? My understanding is that this conditional would check if the site is on dotcom, right? Additionally, I'm a bit concerned that we're replacing a minor nuisance (having to close the lightbox twice) with a potentially bigger confusion (where did the core feature go?). Moreover, this change would go in the opposite direction of our effort to bring a closer-to-core experience. (CC @ianstewart) You mentioned that Jetpack's lightbox provides more features than its core counterpart. Aside from showing metadata and captions (which I don't think are part of core yet) what other features do you have in mind? In any case, if we do go forward with this, I'll add a reminder to document it (cc @donalirl) and I'll share a heads up for dotcom HEs. Thanks again, @jeherve! |
It will, yes, if they've activated the Carousel feature on their site.
This is indeed what I had in mind. On top of this, Core's Lightbox is built with single images in mind, so although it is available for images in galleries it doesn't support galleries yet. Jetpack's Carousel, on the other hand, was built with galleries in mind. |
Fixes #32668 It's best to keep only one lightbox option, to avoid any confusion. Since Jetpack's Carousel feature currently offers more features, let's keep ours in favor of Core's for now. In the future, when core's lightbox option becomes more robust, we can consider deprecating Jetpack's Carousel feature altogether.
Fixes Automattic/wp-calypso#89564 Follow-up to #36565 This is a second take on #36565; we need to ensure that when one disables the Carousel feature on their wpcom simple site, we do not remove Core's Lightbox feature.
) Fixes Automattic/wp-calypso#89564 Follow-up to #36565 This is a second take on #36565; we need to ensure that when one disables the Carousel feature on their wpcom simple site, we do not remove Core's Lightbox feature.
Fixes #32668
Proposed changes:
It's best to keep only one lightbox option, to avoid any confusion. Since Jetpack's Carousel feature currently offers more features, let's keep ours in favor of Core's for now.
In the future, when core's lightbox option becomes more robust, we can consider deprecating Jetpack's Carousel feature altogether.
Warning
This currently breaks some tests on WordPress.com, but I'm not sure how to best address that. Should I simply update the tests to expect that data added by Carousel for now?
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Note
This currently requires the
trunk
version of the Gutenberg plugin. When using the current stable version of the plugin, or no Gutenberg plugin at all, that fix will not work.