Make WordPress Core

Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#57830 closed defect (bug) (fixed)

Block Editor: Revert anchor support for dynamic blocks

Reported by: mamaduka's profile Mamaduka Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.2 Priority: normal
Severity: normal Version: 6.2
Component: Editor Keywords: gutenberg-merge has-patch has-testing-info commit
Focuses: Cc:

Description

The featured introduced content markup regression in WP 6.2, and it's too complex to resolve in this cycle. So instead, we're going to remove the feature from the release.

Note: We're not reverting changes made to the $attributes_to_merge list. It is necessary to continue work on the feature in the Gutenberg plugin.

Original commit: https://core.trac.wordpress.org/changeset/55230
Related Gutenberg PR: https://github.com/WordPress/gutenberg/pull/48592

Testing Instructions

Use the instructions provided in the bug report - https://github.com/WordPress/gutenberg/issues/48232#issue-1590604475.

Attachments (2)

trac57830-before-fix-applied.gif (803.5 KB) - added by hellofromTonya 17 months ago.
Test Report: Reproduce bug (before PR 4148 is applied) 🐞
Trac57830-after-applying-fix.gif (854.6 KB) - added by hellofromTonya 17 months ago.
Test Report: After applying PR 4148 - resolves the bug ✅

Download all attachments as: .zip

Change History (12)

This ticket was mentioned in PR #4148 on WordPress/wordpress-develop by @Mamaduka.


17 months ago
#1

  • Keywords has-patch added

#2 @Mamaduka
17 months ago

  • Keywords gutenberg-merge added

#3 @hellofromTonya
17 months ago

  • Owner set to hellofromTonya
  • Status changed from new to reviewing

Self-assigning for revert commit.

@hellofromTonya commented on PR #4148:


17 months ago
#4

Note: We're not reverting changes made to the $attributes_to_merge list. It is necessary to continue work on the feature in the Gutenberg plugin.

So this is a partial revert of https://core.trac.wordpress.org/changeset/55230.

@Mamaduka commented on PR #4148:


17 months ago
#5

@hellofromtonya, correct. Only removing ABSPATH . WPINC . '/block-supports/anchor.php' file, but keeping the $attributes_to_merge change, so we can continue work in the plugin.

#6 @hellofromTonya
17 months ago

  • Keywords has-testing-info added

Testing Instructions

Steps to Reproduce

  • Step 1: Create a new post.
  • Step 2: Switch to the Code Editor.
  • Step 3: Insert the following markup into the editor:
    <!-- wp:paragraph -->
    <p>Paragraph without anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:paragraph -->
    <p id="anchor">Paragraph with anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:heading -->
    <h2>Heading without anchor</h2>
    <!-- /wp:heading -->
    
    <!-- wp:heading -->
    <h2 id="anchor">Heading with anchor</h2>
    <!-- /wp:heading -->
    
    <!-- wp:group {"layout":{"type":"constrained"}} -->
    <div id="anchor" class="wp-block-group"></div>
    <!-- /wp:group -->
    
  • Step 4: Publish (or update) the post. 🐞 The markup is changed.

Expected Results:

When testing a patch to validate it works as expected:

  • ✅ The markup should not change.

When reproducing the bug:

  • The markup is changed to:
    <!-- wp:paragraph -->
    <p>Paragraph without anchor</p>
    <!-- /wp:paragraph -->
    
    <!-- wp:paragraph -->
    <p><p id="anchor">Paragraph with anchor</p></p>
    <!-- /wp:paragraph -->
    
    <!-- wp:heading -->
    <h2 class="wp-block-heading">Heading without anchor</h2>
    <!-- /wp:heading -->
    
    <!-- wp:heading {"anchor":"anchor"} -->
    <h2 class="wp-block-heading" id="anchor">Heading with anchor</h2>
    <!-- /wp:heading -->
    
    <!-- wp:group {"layout":{"type":"constrained"}} /-->
    }}
    
    Issues:
    * The paragraph block with the anchor are nested in the `p` element
    * A comment about `anchor` attributes has been added to the heading block
    * The anchor in the group block are missing
    
    
      **Test Report Icons:**
      🐞 <= Indicates where issue ("bug") occurs.
      ✅ <= Behavior is ''expected''.
      ❌ <= Behavior is ''NOT expected''.
    

@hellofromTonya
17 months ago

Test Report: Reproduce bug (before PR 4148 is applied) 🐞

@hellofromTonya
17 months ago

Test Report: After applying PR 4148 - resolves the bug ✅

#7 @hellofromTonya
17 months ago

  • Version set to trunk

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/4148

Environment

  • OS: macOS
  • Localhost: wp-env (Docker)
  • Browser: Chrome
  • Plugins: none
  • Theme: TT3
  • WordPress: trunk

Actual Results

When reproducing a bug/defect:

When testing the bugfix patch:

#8 @hellofromTonya
17 months ago

  • Keywords commit added

Prepping the commit

#9 @hellofromTonya
17 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 55443:

Editor: Partial revert of r55230.

[55230] introduced a regression to the content markup. This changeset is a partial revert to remove the added wp-includes/block-supports/anchor.php file.

The change of adding 'id' to $attributes_to_merge in get_block_wrapper_attributes() is not reverted as this change did not impact the regression and helps to support continue development in Gutenberg for the anchor support in dynamic blocks feature.

Reference:

Follow-up [55230].

Props wildworks, mamaduka, hellofromTonya.
Fixes #57830.
See #56852.

Note: See TracTickets for help on using tickets.