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

Empty link in a block cannot be removed until it's fixed with a proper destination #69481

Open
3 of 6 tasks
janmckell opened this issue Mar 6, 2025 · 1 comment
Open
3 of 6 tasks
Labels
[Type] Bug An existing feature does not function as intended

Comments

@janmckell
Copy link

Description

What happens:
When there is an empty link, clicking on the link icon should remove the link without having to configure a proper destination first.
In some cases, the 'unlink' icon shows in the toolbar, and in other environments, it doesn't. The behavior should be consistent, especially when the link assignment is incorrect or incomplete.

Step-by-step reproduction instructions

Create a new post.
Add a paragraph block and ensure that a link is added which is not redirecting to any URL - an empty link.
Click on the link to unlink the text.
Unlinking can only occur after an actual link is added to the text, and the unlink icon where it shows, does so after an actual link is added.

For Testing:
I am not sure what causes a empty link to exist in the first place, but here is a test block you can reproduce the issue with:

<!-- wp:paragraph -->
<p><a>This is a test.</a></p>
<!-- /wp:paragraph -->

Screenshots, screen recording, code snippet

https://cloudup.com/cEqcgqrwpEs

https://cloudup.com/cFfUILwYKKz

Environment info

Tested with both Gutenberg 19.8 and 20.3.0.

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@Rishit30G
Copy link
Contributor

Thanks for sharing the issue,

I was able to replicate it. Before looking into it further, I’d like to understand why we need to use the code editor for this task when the same can be done using the visual editor, which already handles the empty link case. Is there a specific use case for this ? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants