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 Link URL setting in Inspector Controls does not allow you to delete last character #60758

Open
fabiankaegy opened this issue Apr 15, 2024 · 6 comments
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended

Comments

@fabiankaegy
Copy link
Member

Description

The URL setting in the naviation link blocks settings sidebar does not allow you to remove the final character. So if you for example have an anchor link in there you are not able to delete the # from the URL.

Step-by-step reproduction instructions

  1. Go to the site editor
  2. Select a navigation menu
  3. Add a new custom link menu item
  4. Open the settings sidebar
  5. Try to remove the URL via the text field in the sidebar

You should be able to remove everything including the last character

Screenshots, screen recording, code snippet

CleanShot.2024-04-15.at.21.48.07.mp4

Environment info

  • WordPress 6.5.2
  • TT4 Theme

Also:

  • WordPress 6.5.2
  • Gutenberg Trunk
  • TT4 Theme

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

@fabiankaegy fabiankaegy added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block [Block] Navigation Link Affects the Navigation Link Block labels Apr 15, 2024
@fabiankaegy
Copy link
Member Author

fabiankaegy commented Apr 15, 2024

I believe the issue may be this check here:

...( newUrl && { url: encodeURI( safeDecodeURI( newUrl ) ) } ),

It checks that the URL is truthy via the && check. Which would fail for empty strings.

@Mamaduka
Copy link
Member

When I update the logic and allow setting an empty URL value, this is what happens: the URL popover opens and steals the focus.

Screenshot

CleanShot.2024-04-16.at.13.09.52.mp4

@Mamaduka
Copy link
Member

It looks like the issue might have been introduced via #49417.

@scruffian, I know it's super old PR, but maybe you can remember why this change was needed.

P.S. The issue affects older versions of WP if we don't meet the timeline for the next minor release. It should be fine to bump this until the next major.

@Mamaduka
Copy link
Member

Mamaduka commented May 5, 2024

I've yet to test this, but a proposed fix in #61374 might help us fix this issue.

@scruffian
Copy link
Contributor

@scruffian, I know it's super old PR, but maybe you can remember why this change was needed.

Sorry I can't remember!

@getdave
Copy link
Contributor

getdave commented Nov 20, 2024

This is still a problem. When you correct the logic the rich text of the label in the block canvas steals the focus.

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

No branches or pull requests

4 participants