Skip to content

Add "unlink" button to Block toolbar when link UI is open #33850

@getdave

Description

@getdave

Is there an existing issue for this?

  • I have searched the existing issues

Have you tried deactivating all plugins except Gutenberg?

  • I have tested with all plugins deactivated.

Have you tried replicating the bug using a default theme e.g. Twenty Twenty?

  • I have tested with a default theme.

Description

When editing links in the Nav Block and the link UI is open you should be able to click the link icon and have it unlink the link (remove). Currently it just re-toggles the link UI which is unexpected (and pointless 😄 ).

As per my recent PR to add a Unlink button to the link UI, let's add the same functionality in the Block Toolbar but ONLY when the link UI is open (otherwise it's impossible to trigger the link UI to appear once you've added link!).

Step-by-step reproduction instructions

  1. Add Nav Block.
  2. Add link.
  3. Click on link to open the Link UI.
  4. Click on "link" icon in the block toolbar.
  5. See it doesn't not unlink but instead re-toggles the Link UI.

Expected Behavior

Clicking the link icon (which should be an unlink icon) when there is a current link and the link UI is open should remove the link.

Current Behavior

Clicking the link icon (which should be an unlink icon) when there is a current link and the link UI is open re-toggles the link UI and does nothing.

Screenshots or screen recording (optional)

Screen.Capture.on.2021-08-03.at.14-46-05.mp4

Code snippet (optional)

No response

WordPress Information

No response

Gutenberg Information

No response

What browsers are you seeing the problem on?

No response

Device Information

No response

Operating System Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions