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

Button Block: Switching between Gutenberg plugin and Core causes invalid content #21828

Closed
ianbelanger79 opened this issue Apr 23, 2020 · 3 comments
Labels
[Block] Buttons Affects the Buttons Block

Comments

@ianbelanger79
Copy link
Contributor

Switching between the Gutenberg plugin and Core causes invalid content in button blocks.

To reproduce

  1. Activate the Gutenberg plugin
  2. Add a button block
  3. Deactivate the Gutenberg plugin
  4. Button blocks added while the GB plugin is active now show invalid content.

We need to ensure backwards compatibility, because previously button blocks were wrapped in p tags and now they are not. This causes the color and alignment options to no longer work properly in the editor. I tested this in both Twenty Twenty and Twenty Nineteen.

Screenshots:
Buttons added when GB plugin was active, but is now inactive.
button-block-issue

Versions:

  • WordPress version: trunk
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? both
  • If the Gutenberg plugin is installed, which version is it? master and 7.9.1

Environment:

  • OS: Windows 10
  • Browser chrome, firefox
  • Version latest

Related Issues:

@ianbelanger79 ianbelanger79 added [Type] Bug An existing feature does not function as intended Backwards Compatibility Issues or PRs that impact backwards compatability [Type] Regression Related to a regression in the latest release [Block] Buttons Affects the Buttons Block labels Apr 23, 2020
@youknowriad
Copy link
Contributor

Can you give the exact markup used in the previous version as I'm not able to reproduce with any markup, Thanks

@youknowriad youknowriad added the [Status] Needs More Info Follow-up required in order to be actionable. label Apr 27, 2020
@dreamwhisper
Copy link

dreamwhisper commented Apr 28, 2020

@youknowriad I also saw this with Gutenberg 7.9.1 doing the following, but saw similar issues

  1. Create a button with WordPress 5.4.
  2. Install and activate Gutenberg 7.9.1.
  3. Edit the page containing the button and click update.
  4. Deactivate Gutenberg.
  5. Edit the page containing the button - you should see the invalid content warning for buttons.

Diff before/after:
Screen Shot 2020-04-28 at 9 11 26 AM

I also saw this happen for some headings and paragraphs.

Screen Shot 2020-04-28 at 9 50 40 AM

With the latest changes to master, it appears to occur when a custom color is used.
Screen Shot 2020-04-28 at 10 30 01 AM

Test case:

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"customBackgroundColor":"#246f90"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-background" href="#" style="background-color:#246f90">This is a Button with a custom Color</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

<!-- wp:heading {"align":"left","level":1,"customTextColor":"#b87474","className":"is-style-xl-text"} -->
<h1 class="has-text-color has-text-align-left is-style-xl-text" style="color:#b87474">Test Heading</h1>
<!-- /wp:heading -->

@youknowriad
Copy link
Contributor

Deactivate Gutenberg.

Oh sorry I misread the issue initially, and yeah the invalidation here is totally expected since an old block (Core) can't know about the updated markup of the same block (Plugin). That's downgrading and it's not supported for blocks.

I'd say there's nothing we can do here and that's expected behavior.

@youknowriad youknowriad removed [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release [Status] Needs More Info Follow-up required in order to be actionable. Backwards Compatibility Issues or PRs that impact backwards compatability labels Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block
Projects
None yet
Development

No branches or pull requests

3 participants