-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
rel="noopener noreferrer" not immediately added to the markup #9731
Comments
This sounds like it could potentially be a bug with Code Editor / Visual Editor content sync. Related: #9512 |
I am having the same issue |
this is still an issue to me. what has been fixed? |
I am experiencing this issue on some custom blocks as well. Has anyone found a good way to mitigate in the meantime? It seems to have started since upgrading from 4.9.9 to 5.1.1. |
Gutenberg automatically adds a rel="noopener noreferrer" attribute when an anchor has target="_blank". In custom blocks this causes the block to be marked as invalid after saving the post. #bug I'm experiencing the same issue but I found a workaround:
This filter is available since version 5.1.0 |
I am running into issues with custom blocks having validation issues after saving the post like @luistinygod is describing. I was quite confused trying to figure out what was causing the additional
Thanks for the fix @luistinygod! Also, @afercia would you mind moving this to a [bug]? This is unexpected behavior and causes validation errors. This needs to be fixed, not improved. I hope it will get the attention it needs if it's properly labeled as a bug. |
@holtjohnson, in the end I'm not using the hotfix I proposed on my reply. I opted to add the attribute
I think if Gutenberg adds this IMHO, use the |
Thanks for your additional remarks @luistinygod! I like the functionality and agree with Ideally for me, |
I'm running into this issue as well, but am seeing that if the I have a field that lets a user select if a link should be opened in a new tab/window, and so I was defining the |
Related: #14934 |
I don't think I'm able to reproduce this. Can you confirm @afercia ? |
@youknowriad it's not happening for me either for text links as of now. But, it is still happening on image links.
Check the post on the frontend, or save/update and refresh the editor. You will find it there. |
This is a workaround for a wordpress bug. See: WordPress/gutenberg#9731 for more information.
Still a frustrating error for me. I made a block that creates a custom link button, which has large and medium sized text within. Basically, not something you can make with regular blocks. Every time I would save and reload, I would come back to the page with a dozen validation warnings (Having placed a dozen blocks on the page). I think the problem could be solved in three different ways.
Currently, my only way to go is to disable the feature using the |
Hi @youknowriad, The solutions suggested by @cngodles and others seem to be useful; would be great to see them incorporated. Thanks! |
@tyrann0us I've opened #39319 to add the "rel" automatically in the image block like it's done in other blocks. That said, this is not going to avoid the invalidation issues for third-party blocks, the only solution for that is to do what @luistinygod suggest here #9731 (comment) Basically, everytime a block adds a |
When inserting a link, Gutenberg automatically adds a rel="noopener noreferrer" attribute, see related #6316 and #6028
However, the added attribute is not immediately visible in the editor markup. To reproduce:
<p>This is a <a href="http://build.wordpress-develop.test/hello-world/" target="_blank">target blank</a> link.</p>
While the attribute is correctly added in the front-end, it's not immediately visible in the editor markup. This could be potentially confusing for users.
To make it appear also in the editor markup:
The text was updated successfully, but these errors were encountered: