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: Add support for separators between menu items. #23293

Open
Tracked by #35521
alaczek opened this issue Jun 19, 2020 · 22 comments
Open
Tracked by #35521

Navigation block: Add support for separators between menu items. #23293

alaczek opened this issue Jun 19, 2020 · 22 comments
Labels
[Block] Navigation Affects the Navigation Block Needs Dev Ready for, and needs developer efforts [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Status] Blocked Used to indicate that a current effort isn't able to move forward [Type] Enhancement A suggestion for improvement.

Comments

@alaczek
Copy link

alaczek commented Jun 19, 2020

A popular design pattern is to have some sort of separator between top-level menu items.

These could take many forms, but two very popular are dots and dashes:

image

image

How could we introduce those? My first thought was via block styles but maybe there's a better way to offer more flexibility with choosing the separator?

@annezazu annezazu added [Block] Navigation Affects the Navigation Block [Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Type] Enhancement A suggestion for improvement. labels Jun 22, 2020
@annezazu annezazu added this to Inbox in Navigation editor via automation Jun 22, 2020
@talldan
Copy link
Contributor

talldan commented Jun 26, 2020

Great point @alaczek. It could also be a separate block.

There's already a core Separator block that would work in vertical navigation menus.

Generally in horizontal navigations the separator is more for styling, whereas in vertical menus it's often used to divide links up into logical sections, but a block could serve both purposes.

Thinking technically, if the nav menu orientation were exposed as part of the new Block Context API, a separator block could be smart enough to use that to determine how it should appear.

@talldan talldan added the New Block Suggestion for a new block label Jun 26, 2020
@draganescu draganescu moved this from Inbox to Design in Navigation editor Jul 8, 2020
@draganescu draganescu added Needs Design Needs design efforts. and removed New Block Suggestion for a new block [Feature] List View Menu item in the top toolbar to select blocks from a list of links. labels Jul 8, 2020
@ntsekouras
Copy link
Contributor

Maybe this could be handled with an object containing information about the separator and apply the effects with css in before / after content property? This will have of course the limitations of supporting content for the content property, but would work for most cases since the separator is something simple and usually a single character or small image.

I am talking about an object since it probably must have more configuration, ex nested menus. Do we apply it to all menu items?

In a simple one level horizontal menu case it could work with just setting the separator character.

This would be simpler than inserting a new block between each menu item and could be targeted only to horizontal menus.

@draganescu
Copy link
Contributor

This issue has been discussed on Slack in the weekly Navigation Sync meeting.

There are at least two options here to explore in the issue before we begin implementing:

  • adding stylistic separators (via CSS class, invisible in html)
  • adding semantic separators (via a block, visible in html)
@draganescu draganescu removed this from Design in Navigation editor Jul 15, 2020
@shaunandrews shaunandrews added this to Inbox in Navigation editor via automation Aug 18, 2020
@draganescu
Copy link
Contributor

Howdy @shaunandrews 👋 I will remove this issue from the project as it is not a requirement for the navigation editor to support.

@draganescu draganescu removed this from Inbox in Navigation editor Aug 19, 2020
@shaunandrews
Copy link
Contributor

Here's a quick look at how the Navigation block could add support for decorative separators:

navigation separator

@shaunandrews shaunandrews added Needs Dev Ready for, and needs developer efforts and removed Needs Design Needs design efforts. labels Aug 19, 2020
@mtias
Copy link
Member

mtias commented Aug 26, 2020

This seems like it should be a simple to execute styling option, not a block or anything like that.

@cpapazoglou
Copy link
Contributor

Initial commit on addressing the separators in the navigation block #25339

@ZebulanStanphill
Copy link
Member

Quoting my comment on #25339:

I think adding this option is a bad idea. Can't this sort of thing be handled entirely by theme styles? And shouldn't it? It seems like a recipe for inconsistent design to allow the user to choose different separators for different Navigation blocks. That's the job of the theme (and possibly the upcoming Global Styles feature). I already think the option to show/hide the submenu indicator was a mistake. I really, really don't think we should be adding even more options like it.

@mtias
Copy link
Member

mtias commented Sep 25, 2020

I think we can leave this one on pause for a bit and see what feedback we get from theme and pattern creators. The balance between complexity and usefulness seems to lean a bit on the wrong side.

@draganescu draganescu added the [Status] Blocked Used to indicate that a current effort isn't able to move forward label Sep 28, 2020
@cpapazoglou cpapazoglou removed their assignment Jan 11, 2021
@jasmussen
Copy link
Contributor

Coming in fresh to this one, my first instinct was the same as Niks in #23293 (comment).

This is something pseudo before/after CSS can accomplish this, making it more of a theme issue than anything else. I did a little testing. This CSS adds a slash separator between menu items:

.wp-block-navigation-link::after {
	content: "/"
}

It works in the editor and frontend, though not beautifully:

Screenshot 2021-01-26 at 09 35 24

That could be improved with a little more CSS rules. And general improvements to the the markup for the navigation block front and editor views will also benefit this.

@draganescu
Copy link
Contributor

@jasmussen that's yet another argument to close this issue, right?

@jasmussen
Copy link
Contributor

I would say so yes, with the option to reopen or revisit if / when it becomes relevant again.

@mtias
Copy link
Member

mtias commented Jan 29, 2021

I think it's still worth exploring solutions that allow the user to edit these, but should not be high priority.

@mtias mtias reopened this Jan 29, 2021
@mtias mtias added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label Jan 29, 2021
@priethor priethor added this to To do in Navigation block via automation Apr 23, 2021
@annezazu
Copy link
Contributor

annezazu commented Mar 1, 2022

As part of the twelfth call for testing for the FSE Outreach Program, feedback came in around how it's not currently possible to create button like menu items using the navigation block:

I ran into two primary issues with this experiment. One of the problems I had a year ago with FSE Outreach 4 was creating a menu that had button-like links. This basic design is still impossible with the Navigation block, at least with the core design tools. Users can add a background to the entire Navigation block but not to the individual menu items. How did I do it? I used a Buttons block instead. The more I think about it now, the more I like the Buttons block alternative. However, there is no way to wrap this in a <nav> tag to define it as a navigation element.

Here's the design in question:

pizza-button-links

Felt relevant to share here when considering how to add separators between menu items, even if that separator is just simply space between.

@jasmussen
Copy link
Contributor

Nice one Anne, it seems like if individual Page Links received the ability to employ background & text colors, as well as padding control and perhaps even border and border radius, combined with setting a gap of 1px, you'd be able to accomplish that design. The gap (block spacing) is already possible, the other items should be possible by editing theme.json manually, but might be worth ticketing separately. One half of it would be surfacing those properties no the Page Link inspector so you could apply the style piecemeal or using multi-select. The other half would be surfacing the Page Link block in global styles, so you could apply it across all instances at once.

@mohanrangasamy
Copy link

Here's a quick look at how the Navigation block could add support for decorative separators:

navigation separator

Hi Shaun please share some references for the same block

@mrfoxtalbot
Copy link

This would be a lovely feature to have, +1.

@UltimateByte
Copy link

UltimateByte commented Nov 7, 2023

Hi Shaun please share some references for the same block

That would be awesome. I feel like it's really missing when customizing WordPress websites via full site editing and that's how I ended up on this issue.

I would also add that to me, given how Gutenberg has evolved into full site editing, it has become a much higher priority feature.

@draganescu
Copy link
Contributor

I wonder if this should be style variations of the block provided by the theme or a plugin?

@UltimateByte
Copy link

I wonder if this should be style variations of the block provided by the theme or a plugin?

Some menu blocks provided by third parties have this feature. But it's so simple and essential that for me it should be added to the core.

Dont hesitate to upvote or downvote this comment to show your thoughts. 👍 👎

@margaretschneider
Copy link

Giving this one a +1; it would help me a lot while working on a client site with an FSE theme.

@draganescu
Copy link
Contributor

There are two problems with this in core (none of which are blocking - for anyone who would like to explore with code):

  • core will support a limited set of possible separators (dot, dash, pipe ...) while design possibilities are a lot more. So we may want to consider a way to extend the available separators, somehow. Which again makes me wonder why not add a variation via CSS and get the same result?
  • will other blocks ever need separators? Are separators a "setting" of the block or a "style"? If it's a style should it be a block supports?
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 Needs Dev Ready for, and needs developer efforts [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Status] Blocked Used to indicate that a current effort isn't able to move forward [Type] Enhancement A suggestion for improvement.