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

Unlinking Submenu block causes empty href attribute on front of site #43897

Closed
getdave opened this issue Sep 6, 2022 · 4 comments · Fixed by #44337
Closed

Unlinking Submenu block causes empty href attribute on front of site #43897

getdave opened this issue Sep 6, 2022 · 4 comments · Fixed by #44337
Assignees
Labels
[Block] Submenu Affects the Submenu Block - for submenus in navigation [Type] Bug An existing feature does not function as intended

Comments

@getdave
Copy link
Contributor

getdave commented Sep 6, 2022

Description

Unlinking Submenu block causes empty href attribute on front of site.

Step-by-step reproduction instructions

  1. Add Nav block.
  2. Add Submenu with a link and add one item inside the submenu.
  3. Click on Submenu block and click the link icon.
  4. Remove the link from the block using the "Unlink" icon in the Link UI.
  5. Publish post.
  6. Switch to front of site and see empty href on the submenu item in the Nav.

Screenshots, screen recording, code snippet

Screen Shot 2022-09-06 at 10 27 53

Environment info

No response

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

@getdave getdave added [Type] Bug An existing feature does not function as intended [Block] Submenu Affects the Submenu Block - for submenus in navigation labels Sep 6, 2022
@carolinan
Copy link
Contributor

Hi,
What is the expected result? I mean, what change needs to be implemented, should the whole link be removed, and only text displayed?

@getdave
Copy link
Contributor Author

getdave commented Sep 6, 2022

I don't have the answer to that at this stage. An empty href is invalid so we'd need to decide on the most appropriate markup and / or behaviour.

@aristath
Copy link
Member

Hmmm if empty we could make it #. Would that make sense?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 21, 2022
@getdave
Copy link
Contributor Author

getdave commented Sep 21, 2022

I looked into this some more. I turns out it's valid to have a elements without an href.

The href attribute on a and area elements is not required; when those elements do not have href attributes they do not create hyperlinks.

I've created a PR which conditionally adds the href depending on whether it's not empty.

#44337

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Submenu Affects the Submenu Block - for submenus in navigation [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants