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 anchor support from dynamic blocks #51288

Merged
merged 2 commits into from
Jun 11, 2023
Merged

Conversation

t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Jun 7, 2023

Fixes: #48232
Fixes: #49382
Fixes: #49578

Related to: #48438

What?

This PR reverts anchor support for dynamic blocks added by #44771.

Why?

In #44771, anchor support was added to dynamic blocks, but static blocks with existing anchor were broken (See #48232, #49382, and #49578). This feature was originally planned to be included in WordPress 6.2, but #48232 was the first to report this issue during the Beta phase. Therefore, by #48592, this feature was excluded in the WordPress 6.2 release.

However, this feature still remains on the Gutenberg plugin, which will be bundled with WordPress 6.3 and will cause similar problems. A solution was attempted in #48438, but we decided to revert anchor support for dynamic blocks in the Gutenberg plugin as well, in order to find a more ideal solution.

How?

Strikes out the changes made in #44771 as is, removing anchor support for a total of 53 dynamic blocks. After #44771 was merged, a new Time To Read block was added. However, this block does not currently support anchor, so it does not need to be considered in this PR.

Testing Instructions

  • To test the impact of this PR, the following four types of blocks should be tested:
    • Static block without anchor
    • Static block with anchor
    • Dynamic block without anchor
    • Dynamic block with anchor
  • In the trunk branch, insert all types of blocks as follows:
    <!-- wp:paragraph -->
    <p>Static block without anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:paragraph {"anchor":"anchor"} -->
    <p id="anchor">Static block with anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:site-title /-->
    
    <!-- wp:site-title {"anchor":"anchor"} /-->
  • Switch to this PR branch and reload the editor. There should be no blocks to be broken.
  • Open the Advanced tab of the dynamic block and confirm that the HTML ANCHOR is not present.
  • Make changes to the content, save the post, and reload. There should be no blocks to be broken.
  • Open the code editor and confirm that the saved markup has changed as follows:
    <!-- wp:paragraph -->
    <p>Static block without anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:paragraph -->
    <p id="anchor">Static block with anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:site-title /-->
    
    <!-- wp:site-title /-->

@t-hamano t-hamano self-assigned this Jun 7, 2023
@t-hamano t-hamano added [Feature] Blocks Overall functionality of blocks Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts Backwards Compatibility Issues or PRs that impact backwards compatability labels Jun 7, 2023
@t-hamano t-hamano marked this pull request as ready for review June 7, 2023 11:43
@t-hamano t-hamano changed the title [WIP] Remove anchor support from dynamic blocks Remove anchor support from dynamic blocks Jun 7, 2023
@Mamaduka Mamaduka requested a review from Soean June 7, 2023 12:08
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Nice work @t-hamano 👍

The changes here revert those made in #44771 and it all tests well for me following the test instructions.

I'm happy to approve this but it might be good to get a double-check from @Soean who authored the original PR.

@t-hamano t-hamano merged commit 259c8e7 into trunk Jun 11, 2023
@t-hamano t-hamano deleted the revert/dynamic-block-anchor branch June 11, 2023 11:32
@github-actions github-actions bot added this to the Gutenberg 16.1 milestone Jun 11, 2023
@t-hamano
Copy link
Contributor Author

Note: This PR contains changes to PHP files, but a similar PR has already been merged into the wp/6.2 branch (#48592). I also checked the trunk branch of WP core just to be sure, but the PHP files and lines deleted in this PR do not exist in WP core. Therefore, I think no PHP backport should be necessary.

@ramonjd
Copy link
Member

ramonjd commented Jun 13, 2023

Thanks @t-hamano

I'll remove #44771 from the list of PHP changes to be backported to Core for 6.3

👍

nk-o added a commit to nk-crew/lazy-blocks that referenced this pull request Jun 30, 2023
add this attribute manually because of this Gutenberg's change WordPress/gutenberg#51288
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
* Remove anchor support from dynamic blocks

* Remove unnecessary codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Blocks Overall functionality of blocks Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
4 participants