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

Converting a paragraph into a heading (or viceversa) will break the block if it contains a link #28111

Closed
mrfoxtalbot opened this issue Jan 11, 2021 · 5 comments · Fixed by #28136
Assignees
Labels
[Feature] Block Transforms Block transforms from one block to another [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@mrfoxtalbot
Copy link

mrfoxtalbot commented Jan 11, 2021

Trying to convert a paragraph block into a heading (or the other way around) will cause the block to break if it includes a link

To reproduce

  1. Create a new post
  2. Add a paragraph
  3. Add a link inside the paragraph
  4. Convert the paragraph block into a heading.

Expected behavior
The paragraph should convert into a heading without issues but instead, it broke.

Screenshots
Kapture 2021-01-11 at 15 13 27

Editor version:

  • WordPress version 5.6
  • Gutenberg plugin version 9.7.0
  • The problem does not occur without the plugin
  • I was also able to reproduce this exact error on a free (simple) WordPress.com site

The exact same problem arises if you do the opposite: create a heading, add a link and try to convert it into a paragraph.

The console returns this error:

react-dom.min.de439aae.js:125 TypeError: Cannot read property 'ownerDocument' of undefined
    at index.js?ver=5f012ae2a1c6dc1a4b432c305b2be604:1
    at Object.useMemo (react-dom.min.de439aae.js:216)
    at d.useMemo (react.min.e713ea3b.js:32)
    at st (index.js?ver=5f012ae2a1c6dc1a4b432c305b2be604:1)
    at index.js?ver=16801eb7527d46a7b6c21552167c80f5:1
    at we (react-dom.min.de439aae.js:84)
    at zj (react-dom.min.de439aae.js:226)
    at Th (react-dom.min.de439aae.js:152)
    at tj (react-dom.min.de439aae.js:152)
    at Te (react-dom.min.de439aae.js:146)

If I switch to the "Code View" I see this markup:

 <a href="react-dom.min.de439aae.js:125 TypeError: Cannot read property 'ownerDocument' of undefined
    at index.js?ver=5f012ae2a1c6dc1a4b432c305b2be604:1
    at Object.useMemo (react-dom.min.de439aae.js:216)
    at d.useMemo (react.min.e713ea3b.js:32)
    at st (index.js?ver=5f012ae2a1c6dc1a4b432c305b2be604:1)
    at index.js?ver=16801eb7527d46a7b6c21552167c80f5:1
    at we (react-dom.min.de439aae.js:84)
    at zj (react-dom.min.de439aae.js:226)
    at Th (react-dom.min.de439aae.js:152)
    at tj (react-dom.min.de439aae.js:152)
    at Te (react-dom.min.de439aae.js:146)">Ut enim ad minim veniam</a>
@gziolo gziolo added [Feature] Block Transforms Block transforms from one block to another Needs Testing Needs further testing to be confirmed. labels Jan 11, 2021
@leewillis77
Copy link
Contributor

I can reproduce this only if the whole of the paragraph is a link. E.g.

Works fine:
This is a link in a paragraph

Breaks:
This is a whole-paragraph link

@mrfoxtalbot
Copy link
Author

mrfoxtalbot commented Jan 12, 2021

That's interesting @leewillis77. I came across this error a couple of times and I did not report it earlier because I could not reproduce it consistently. In some instances, it happened only when the entire paragraph was a link but in other instances, it happened with just one word being a link.

Should I update the name of the issue or its description to reflect this?

@leewillis77
Copy link
Contributor

@mrfoxtalbot If you think you can reproduce it with mixed content then leave as-is. I was just noting my experience trying to reproduce the issue.

@mrfoxtalbot
Copy link
Author

mrfoxtalbot commented Jan 12, 2021

I was just able to reproduce this error linking just a single word, using the Gutenberg plugin (Version 9.7.1 )

Kapture 2021-01-12 at 12 34 53

I also noticed that if you duplicate the broken block, it will look fine. Weird!

Kapture 2021-01-12 at 12 32 18

@ntsekouras
Copy link
Contributor

It seems to break when the URL popover is open. That explains the inconsistency of reproducing it - I'll look more into it though.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 12, 2021
@gziolo gziolo added [Type] Regression Related to a regression in the latest release and removed Needs Testing Needs further testing to be confirmed. labels Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Transforms Block transforms from one block to another [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants