wordpress-seo
wordpress-seo copied to clipboard
When modifying the link in anchor text and using the Yoast SEO nofollow and sponsored attributes, the link is split into two parts.
- [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
When you add a link to text in the post, and then highlight it and edit it, and add the 'opens in new tab', 'nofollow', and 'sponsored' attributes and save the changes, it splits the link into two.
To Reproduce
Step-by-step reproduction instructions
- Install and activate Yoast SEO 21.8 and use a default WP theme
- Create a new post and add a link/anchor text to content in the post that has at least two words (e.g. Yoast SEO)
- Highlight (very specific step, don't just click on the link) the anchor text, click on the pencil icon, and add the 'opens in new tab', 'nofollow', 'sponsored' attribute and save the changes. Sometimes it doesn't happen on the first link, and you'll need to reproduce it on a second link.
Expected results
- That the anchor text or link would still be in one single section.
Actual results
- The links are split into two (one seems to have the 'open in new tab' option selected and the other attributes, and the other one doesn't have any of the selected attributes)
Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.
https://github.com/Yoast/wordpress-seo/assets/30507511/b2c028d5-c44f-435c-818c-a4ba7492022c
When deactivating the Yoast SEO plugin and just using the default 'opens in a new tab' and 'nofollow' anchor text link options, the issue doesn't seem to occur. But it doesn't look to be specific to the 'sponsored' option, as even if you don't choose all 3 settings, the issue still occurs.
When you click on the link to edit it, instead of highlighting it, the issue doesn't seem to occur.
Technical info
- If relevant, which editor is affected (or editors):
- [x] Block Editor
- Which browser is affected (or browsers):
- [x] Chrome
Used versions
- Device you are using: MacBook Pro M1
- Operating system: MacOS
- PHP version: PHP 8.0
- WordPress version: 6.2
- WordPress Theme: Twenty-Twenty
- Yoast SEO version: 21.8
Please inform the customer of conversation # 1094090 when this conversation has been closed.
+1 https://wordpress.org/support/topic/possible-duplicate-editing-highlighted-link-adds-additional-link/