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 link popover has a 0 in it after unlinking and relinking #36170

Closed
talldan opened this issue Nov 3, 2021 · 2 comments · Fixed by #36198
Closed

Navigation block link popover has a 0 in it after unlinking and relinking #36170

talldan opened this issue Nov 3, 2021 · 2 comments · Fixed by #36198
Assignees
Labels
[Block] Navigation Link Affects the Navigation Link Block [Block] Navigation Affects the Navigation Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@talldan
Copy link
Contributor

talldan commented Nov 3, 2021

Description

There's a 0 being shown in the nav block's link UI after a particular sequence of steps. I imagine this is accidentally being returned from a React component instead of null or undefined.

Step-by-step reproduction instructions

  1. Add a nav block
  2. Start empty
  3. Add a link
  4. Select a URL to a page or post
  5. Once done, click the link icon on the toolbar
  6. Click the 'unlink' button in the link popover
  7. Click on the 'Add link' text
  8. Observe the link popover shows with a 0 in the top left corner

Screenshots, screen recording, code snippet

Screenshot 2021-11-03 at 5 07 31 pm

Environment info

Tested on latest trunk at the time of writing.
Tested using Brave on Mac OS.

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

@talldan talldan added [Type] Bug An existing feature does not function as intended Good First Issue An issue that's suitable for someone looking to contribute for the first time [Block] Navigation Affects the Navigation Block [Block] Navigation Link Affects the Navigation Link Block labels Nov 3, 2021
@Mamaduka
Copy link
Member

Mamaduka commented Nov 3, 2021

If anyone is interested, this is the line that caused the bug:

const showTextControl = value?.url?.trim()?.length && hasTextControl;

You can find details about "why" this is happening in new React docs (see the "Gotcha" part).

@amustaque97
Copy link
Member

I would love to take this forward and fix it.

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 Good First Issue An issue that's suitable for someone looking to contribute for the first time [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.

3 participants