Skip to content
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

Remove deprecated controls from editor sidebar and fix AMP Lightbox and AMP Carousel in Gallery block #6833

Merged
merged 18 commits into from
Jan 29, 2022

Conversation

delawski
Copy link
Collaborator

@delawski delawski commented Jan 13, 2022

Summary

Fixes #6508
Fixed #6832
Related #4989
Fixes #6848

Here are the main changes that are introduced by this PR:

  1. Remove ampLayout and ampNoLoading controls from the block editor sidebar (see: Empty AMP Settings panel for video block #6508 (comment)).
  2. Ensure the "AMP Settings" panel in the block editor sidebar is not rendered if there is no content (see: Empty AMP Settings panel for video block #6508).
  3. Remove "Add lightbox effect" toggle from the Image blocks nested in new core Gallery block. Also, ensure that AMP lightbox works as expected with the latest Gutenberg plugin (see: Remove "Add lightbox effect" toggle from Image blocks nested in Gallery block #6832).
  4. Update carousel construction to account for markup changes in Gallery block as of WP 5.9 where images are represented as nested image blocks. See AMP Carousel no longer works in WP 5.9 or latest Gutenberg #6848.

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@delawski delawski self-assigned this Jan 13, 2022
@delawski delawski added Bug Something isn't working Integration: Gutenberg labels Jan 13, 2022
@delawski delawski added this to the v2.3 milestone Jan 13, 2022
@delawski delawski changed the title Remove ampLayout and ampNoLoading controls from editor sidebar Remove deprecated controls from editor sidebar and fix AMP Lightbox in Gallery block Jan 20, 2022
@delawski delawski modified the milestones: v2.3, v2.2.1 Jan 20, 2022
@delawski delawski marked this pull request as ready for review January 20, 2022 14:39
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2022

Plugin builds for 83f143c are ready 🛎️!

…r-amp-settings-panel

* 'develop' of github.com:ampproject/amp-wp:
  Render value as fallback instead of entire parent source object
  Fix logic inversion for sources.length
  Ensure `sources` is non-empty array
  Revert "Ensure error `sources` is never `null`"
  Ensure error `sources` is never `null`
  Ensure `sources` is iterated over only if it is non-empty array
  Fix test to account for gutenberg_render_layout_support_flag() (#6850)
  Support converting YouTube iframes with 100% width to amp-youtube with fixed-height (#6837)
  Update Gutenberg package dependencies
  Update Gutenberg package dependencies
  Allow composer normalize plugin to run
  Normalize Composer file
  Update Composer to use AMP toolbox v0.10.0
…r-amp-settings-panel

* 'develop' of github.com:ampproject/amp-wp: (48 commits)
  Update comments to note where related skip link logic is located
  Improve nested CSS indentation
  Use AMP prefix for styles injected by sanitizer
  Remove needless escaping in DOM context
  Simplify obtaining main element and body element
  Ensure Navigation block script is registered to fix tests
  Add missing test coverage for dequeue_block_navigation_view_script
  Use function exists check for render_block_core_navigation to determine if test should be skipped
  Add attribute value escaping for good measure
  Fix phpcs warnings
  Add more test cases for skip link
  Fix indentation
  Add assertions that no SQL queries run when data deletion is disabled
  Add test specifically for transient deletion
  Harden term deletion logic for WP<4.4
  Add assertions for term deletion
  Flesh out tests specifically for post and term deletion
  Add test specific to delete_user_metadata
  Add test specifically for the delete_options function
  Remove deletion of non-option
  ...
@delawski
Copy link
Collaborator Author

@westonruter Thanks for updating the gallery block sanitizer. I tested it on my local and now the AMP Carousel works as expected with the new Gallery block markup.

@westonruter westonruter changed the title Remove deprecated controls from editor sidebar and fix AMP Lightbox in Gallery block Remove deprecated controls from editor sidebar and fix AMP Lightbox and AMP Carousel in Gallery block Jan 27, 2022
@delawski
Copy link
Collaborator Author

I think this PR is now ready for a final review and merge.

@dhaval-parekh – since both @westonruter and myself worked on this branch, can you do a code review?

@@ -7,6 +7,7 @@

use AmpProject\AmpWP\Embed\HandlesGalleryEmbed;
use AmpProject\Html\Tag;
use AmpProject\Dom\Element;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, Not a blocker.
This could be above use AmpProject\Html\Tag;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. There is already use AmpProject\Html\Tag. The use of AmpProject\Dom\Element is due to this new line:

/** @var Element $gallery_element */

Copy link
Collaborator

@dhaval-parekh dhaval-parekh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

…r-amp-settings-panel

* 'develop' of github.com:ampproject/amp-wp: (37 commits)
  Revert "Use different selector in E2E test"
  Revert "Ensure AMP plugin is activated before running E2E tests"
  Ensure get_page_cache_detail return value is array
  Increase verbosity of hasScannableUrls check
  Ensure AMP plugin is activated before running E2E tests
  Use different selector in E2E test
  Improve strings and comments
  Remove redundant checks for header value being non-empty
  Refine comments
  Remove debug code for catching external requests
  Scope styles for dashicons
  Simplify logic in get_page_cache_detail
  Reuse threshold variable
  Remove erroneous P from wrapping UL
  Fix label when page caching detected and yet response still slow
  Add formatting for millisecond values
  Improve test coverage and simplify conditional
  Simplify translation string
  Speed up tests by using usleep() instead of sleep()
  Only show lack of page caching plugin if no caching response headers present
  ...
@westonruter
Copy link
Member

I tried creating a post with the various cases and there were no block deprecation issues. The settings were removed as expected:

Case Before (WP 5.8 w/ AMP v2.2) After (WP 5.9 w/ this PR)
A video block with the ampLayout set Screen Shot 2022-01-28 at 15 45 29 Screen Shot 2022-01-28 at 15 56 41
An image block with noLoading set Screen Shot 2022-01-28 at 15 45 15 Screen Shot 2022-01-28 at 15 56 31
Video block without any media set Screen Shot 2022-01-28 at 15 45 02 Screen Shot 2022-01-28 at 15 56 52

@westonruter
Copy link
Member

In 5.8 I also had added 4 gallery blocks:

  1. No AMP settings
  2. Carousel
  3. Lightbox
  4. Carousel and Lightbox

When viewing these 4 on the frontend in 5.9 before block migration, they all rendered as expected. And after I edited the post to migrate the gallery blocks to the nested format, they also rendered as expected.

Before After
Screen Shot 2022-01-28 at 16 25 00 Screen Shot 2022-01-28 at 16 24 00

@westonruter westonruter merged commit a0705cd into develop Jan 29, 2022
@westonruter westonruter deleted the fix/editor-amp-settings-panel branch January 29, 2022 00:35
westonruter added a commit that referenced this pull request Jan 29, 2022
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Changelogged Whether the issue/PR has been added to release notes. Integration: Gutenberg
Projects
None yet
3 participants