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: Editing the label of block causes Add Link prompt to appear incorrectly #30163

Closed
annezazu opened this issue Mar 24, 2021 · 5 comments · Fixed by #44733
Closed
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

Description

If you add a Link Block to the navigation block, add a link, and then try to edit the label/text the "Add link" prompt shows up despite a link already being added. This makes it seem as though by deleting the label, you have also removed the link. cc @jasmussen since you're working on this!

Step-by-step reproduction instructions

  1. Add a navigation block
  2. Add a link block
  3. Add a link
  4. Edit the text of the link you added and fully remove the text.
  5. See "Add link" but confirm the link is already still added.

Expected behaviour

I expect the "Add link" prompt to say "Add text" or "Add label" since a link is already in place.

Actual behaviour

The "Add link" prompt shows up.

Screenshots or screen recording (optional)

navigation.block.mov

WordPress information

  • WordPress version: 5.7
  • Gutenberg version: 10.2.1
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? TT1 Blocks

Device information

  • Device: Desktop
  • Operating system: MacOS
  • Browser: Chrome 88
@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block labels Mar 24, 2021
@jasmussen
Copy link
Contributor

It seems clear that blocks like Button, Social Link and Menu Item are all types of blocks that aren't very useful unless they have both a label(/icon) and a URL, and that anything we do to optimize for how it currently works is likely going to be less effective. That's also a bit of what we're discussing in #28440 (comment), and I think I'll try reopening a version of that.

@annezazu
Copy link
Contributor Author

annezazu commented Feb 7, 2022

Just noting that 5.9 still has the same behavior:

5.9.update.mov

@kathrynwp
Copy link

Still able to replicate this with:

WordPress 6.0.2
Gutenberg 14.2.0 active or inactive
No other plugins active
Twenty Twenty-Two 1.2

@jasmussen with the Navigation Block being a focus in 6.1, would you perhaps have a moment to revisit this issue? Thanks!

@jasmussen
Copy link
Contributor

Thanks for the ping. Coming back to this one, it seems like the solutions suggested in my previous comment haven't made much progress. So the simplest solution in that light might be to treat this as a bug: why isn't the content of the navigation item reset when backspacing the entire label?

That does appear to work for plain rich text links:

what happens when I make a link

I wonder why a navigation item would be any different. CC: @draganescu if you have any insights?

@draganescu
Copy link
Contributor

I think the navigation link is different from the inline link because the inline link is visibly removed from the text, while in the navigation block only the label is removed. If we remove the link when we delete all the label text, editing the label from scratch will become impossible.

I think the solution here is to manage the placeholder depending on the navigation link having an URL or not. No URL > add a link, has URL > add a label.

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 [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants