wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

wp-container-{uniqueid}: uniqueid increases when using Yoast

Open R2116 opened this issue 3 years ago • 0 comments

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

The {uniqueid} appended to wp-container--class for some blocks increases when Yoast SEO is active: For some blocks, like the columns block, the columns wrapper and the columns themselves get the classes wp-container-{uniqueid} added. Styles for these classes are added to the header as inline CSS. When Yoast SEO is active, these added numbers increase. Not, if the content is received via REST API or getting the content from the WP_Post and apply the do_blocks filter or the_content filter on it though. That imposes an issue, when loading/ updating content via AJAX: Initially the columns block has different CSS classes then when (re-)loaded via AJAX, the styles are loaded initially for the initial classes, which then don't match anymore.

I believe this could also be an issue on Gutenberg, but I couldn't figure out what Yoast does to make this happen. I guess it is some hook used, but I didn't get to find the one causing it.

Please describe what you expected to happen and why.

The {uniqueid} in the added class should not change by activating Yoast SEO.

How can we reproduce this behavior?

  1. set up empty WordPress with standard theme
  2. create a post or page with columns block, leave one column empty (also not an empty content block). For this example, one with two columns. Fill the other column with at least one character.
  3. check the HTML of the columns. The columns wrapper will have the CSS class wp-container-3, the two columns will have wp-container-1 and wp-container-2.
  4. install & activate Yoast SEO
  5. check the HTML of the columns again. The columns wrapper will now have the CSS class wp-container-4 (instead of 3), the two columns will have wp-container-2 and wp-container-3 (instead of 1 and 2).

Technical info

  • WordPress version: 6.0.1
  • Yoast SEO version: 19.3
  • If relevant, which editor is affected (or editors):
  • [ ] Classic Editor
  • [x] Gutenberg
  • [ ] Classic Editor plugin
  • Which browser is affected (or browsers):
  • [ ] IE11
  • [ ] Edge
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Safari
  • Relevant plugins in case of a bug: no plugins installed besides Yoast SEO
  • Tested with theme: Twenty Twenty-One

R2116 avatar Jul 14 '22 11:07 R2116