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

Navigation block: can't unlink items #18866

Closed
sophiegyo opened this issue Dec 2, 2019 · 15 comments · Fixed by #33775
Closed

Navigation block: can't unlink items #18866

sophiegyo opened this issue Dec 2, 2019 · 15 comments · Fixed by #33775
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended

Comments

@sophiegyo
Copy link

After creating a navigation block and adding a few items, it doesn't seem possible to un-link them.

Gutenberg version tested: 7.0.0

To reproduce
Steps to reproduce the behavior:

  1. Add a new page, and add a navigation block
  2. Add a few items to the block, making sure they're linked pages
  3. Save/publish the page
  4. Attempt to unlink an item by modifying it and deleting the listed page
  5. Notice appears to fill in the field. Clicking away from the field closes it and loses the modification (removal)

Expected behavior
I would have expected to be able to modify the link, to prevent the link from being active!

Screenshots

Chrome:
navblockunlink

Firefox:
navblockff

Desktop (please complete the following information):

  • OS: macOS Mojave 10.14.6
  • Browser: Chrome 78.0.3904.108, also tested on Firefox 70.0.1

I've not yet tested on a smartphone!

@karmatosed
Copy link
Member

I can confirm I also am unable to remove a link once added. Thanks for finding this @sophiegyo.

@karmatosed karmatosed added the [Type] Bug An existing feature does not function as intended label Dec 2, 2019
@obenland
Copy link
Member

obenland commented Dec 3, 2019

Currently the navigation block only allows (navigation) links as child blocks. There has been some exploration in #18442 to allow non-linked links, but I'm not sure that'll be viable. The idea here is that other types of blocks (like a text block in this case) could be added later, to enable a way to create richer navigation menus.

Rather than considering this a bug, I'd advocate for adding the ability to accept other types of child blocks.

/cc @mtias

@sophiegyo
Copy link
Author

sophiegyo commented Dec 9, 2019

Is that still also the case for top-level items? The Firefox screencast I linked shows me trying to unlink a top-level navigation item, rather than a child item.

@noisysocks noisysocks added the [Block] Navigation Affects the Navigation Block label Apr 1, 2020
@ntsekouras ntsekouras added the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label Sep 23, 2020
@paaljoachim
Copy link
Contributor

paaljoachim commented Apr 8, 2021

Testing using WordPress 5.7. Twenty Twenty One. Gutenberg plugin 10.3.2

Clicking a link and removing the url. Then clicking outside of the link control box automatically adds the link back in again.
So yes one can not unlink items. Either one changes the link or one deletes the link. (There still needs to be a way to add text into the menu.)

@gwwar
Copy link
Contributor

gwwar commented Apr 8, 2021

I agree that it'd be good to allow folks to add text headings to help group navigation links. I do think we could let folks add this more directly, vs adding a link and then removing the url. For example in the inserter we might let folks pick adding a heading.

Were there any thoughts on this already? cc @jasmussen or @scruffian

As a quick example Amazon does the following, to group links together. Notice how "Trending" isn't a link

Screen Shot 2021-04-08 at 12 23 31 PM

@shaunandrews
Copy link
Contributor

What purpose does "unlinking" a Link block serve?

As I see it, the Link block (and its variations) requires a URL to do its job. Once set, there's no way to remove a URL, only change it. This is intentional, and I'm not sure we should build a way to "unset" a Link block's URL without some greater purpose or workflow.

@jasmussen
Copy link
Contributor

A few things have changed since this ticket was created, here's a fresh look:

current status

Notably, there's a new menu item placeholder state which does not allow you to edit a label until a link has been added. By adding this we're implicitly saying: a menu item without a link is useless. In that vein, unlinking a menu item isn't directly useful anymore. However we can be clearer about the user experience. While the "The field must be filled out" is a good start, the messaging around it can be improved. I don't know if that has to be this ticket or a separate URL component-specific one.

The second part, being able to add text to a menu, that absolutely should be possible. A brief (and intentionally crazy) exploration suggests that's not going to be too hard. The biggest challenge for that is this ticket. I'm tinkering with a mockup (wip) that relies on being able to add single paragraphs, so it's definitely something we want.

@tellthemachines
Copy link
Contributor

Now that #29036 has been resolved, would this issue be fixed if we allowed adding Paragraph blocks at the top level of the Navigation block? If so, that's easy to sort out 🙂

@jasmussen
Copy link
Contributor

Good thought @tellthemachines. If not the paragraph, then at least a range of other blocks would bring value, so I created #33278 to track that.

If we were to allow the Paragraph block, would that change the default behavior of the appender? I'd think we'd still want the black plus being the only way to add items, rather than having an input field with a slash command prompt.

@tellthemachines
Copy link
Contributor

If we were to allow the Paragraph block, would that change the default behavior of the appender? I'd think we'd still want the black plus being the only way to add items, rather than having an input field with a slash command prompt.

We'd have to look into it, though I'm starting to think using Paragraph might not be a good idea, for multiple reasons outlined here.

@tellthemachines tellthemachines self-assigned this Jul 12, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 12, 2021
@getdave
Copy link
Contributor

getdave commented Jul 30, 2021

Just to say that we have added an Unlink behaviour in the Post Editor. I can add this to the Nav Editor as well.

Update: PR to implement this now ready for review in #33777

@draganescu
Copy link
Contributor

Closed by #33777

@getdave
Copy link
Contributor

getdave commented Aug 4, 2021

@draganescu Worth noting that we may need to create a follow up to address another part of this Issue which is that folks want to be able to create link items which have no hyperlink. I believe this is what @tellthemachines is addressing in #33775

@jasmussen
Copy link
Contributor

#33091 would also be related to link items with no link, insofar as that ticket can only be addressed if we were to allow that.

@tellthemachines
Copy link
Contributor

Hm, I think this was mistakenly closed; it's not possible to create navigation items that render on the front end without links yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended
Projects
None yet