-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: menu links separator #25339
Navigation: menu links separator #25339
Conversation
- add styles for the editor - add styles for the frontend
- adds separators
- prevent outputing if none selected - show separator panel only for horizontal navs - show only for first level nav items
Thanks @shaunandrews for your prompt feedback! In my latest commit 738a4fb I have addressed the following:
Regarding the footprint of the block, I believe it is something we have to live with? |
@@ -73,6 +73,20 @@ $navigation-item-height: 46px; | |||
} | |||
} | |||
|
|||
// Move Separators to before element cause after is used for outlining the block. | |||
.wp-block-navigation > .wp-block-navigation__container > .wp-block-navigation-link { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move ::before to wp-block-navigation-link__label
, then we might be able to have better control over its placement within the block's foot print. I tried to hack it in, and kind of get it working, but then it breaks the data-separator
.
I left a note about moving the pseudo-element from the
Totally agree. -- I think this is a good start and I'd love to see it merged and followed up with some iterations around:
|
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. |
@ZebulanStanphill Could you clarify what you mean by 'theme styles'? Not sure if you're referring to block style variations, or just the CSS added by a theme. |
Thanks @ZebulanStanphill for chiming in
I totally agree with styling decisions being handled by the theme CSS. In that sense though, For example, Again, the separator seems to be a good addition to easily - fast show a separator, I would be very hesitant though to add styles configuration for it (padding, margin, size etc). @shaunandrews thanks for coming back!
Can you clarify what is the problem of the separator being part of the
|
By theme styles, I literally mean styles provided by the current active theme. In the case of Typography settings, there are legitimate use-cases for needing larger than normal text, e.g. a call-to-action. I do think the block editor has gone too far by providing a "Custom" option by default. It should only have provided the presets by default, with an admin setting somewhere to enable the "Custom" option. If we want to "empower users" who can't write CSS, we should be doing that through the Global Styles project. One-off style tweaks are a design anti-pattern. We ought to be encouraging people to style things at a site-wide level and create/use reusable presets, not give them a band-aid solution to tweak one block here and another there... that's a foot-gun that ultimately results in an inconsistent mess. I know from experience, working on websites built with Divi Builder. See also: #23893. |
It's a good point about theme extensibility, @ZebulanStanphill. Though at the same time I think it'd be less than ideal to lock a user into the single separator style provided by a theme's CSS. Is there an incremental approach where we can use a hard coded list first and then hook it into global styles later? Who'd be a good reviewer in terms of global styles that can provide feedback on the PR? I personally don't know enough about it (on my list of things to improve my knowledge of). |
I don't think we should expose this kind of feature at all until we can do so through Global Styles. I think it's a mistake to add stuff at the individual block level first, and then add it at a global level. That encourages one-off customizations in the meantime, and personally, I think some options should always be exclusive to the global and preset level. Divi Builder, for example, added visual controls for pretty much every CSS property imaginable, but at the individual module level. So later, when they finally added a global defaults and global presets system, every website built prior would have a hard time adopting it, because everyone was already using one-off customizations on every page that would override the global settings. And furthermore, people weren't used to doing things at a global level, and the individual module settings were exposed more prominently, so even now, it's easy to fall into the trap of doing every as a one-off, because all the options are more prominent at the one-off level than the global level... when ideally, it should be the opposite. In my opinion, style options should always be added at a global level first. Perhaps include the ability to create reusable presets for that option. And then, if that's still not enough, only then should you consider making it available on the individual block level. We should always encourage doing things the (usually) right way, and we should make that way more obvious than the (usually less ideal) alternatives. Adding stuff in the reverse order is risky because it means we may end up removing options later on, which is annoying due to block deprecations, users who had grown accustomed to doing it one way, and having to continue to style existing blocks, bloating our stylesheets with legacy rules. There's also something to be said for limiting access to style controls to certain user roles. Correct me if I'm wrong, but I think Global Styles is intended to be limited to higher-level WP roles, to prevent other users from messing up the website theme. I am not aware of any method to limit access to certain individual block controls by user role. There are things like the theme support flags (soon to be superseded by In short, I think it's premature to add something like this at the individual block level. I would, however, support the idea of adding this control at the Global Styles level. I also think we should look into adding the ability to easily create global presets through the Global Styles UI. I'm not sure whether these would be block style variations (which I know have some limitations) or something new. |
I think this adds a nice way to add some "flair" to your navigation without having to know CSS or switch themes. I'd expect there to be ways for theme's to opt-in/out and control the values. I also expect Global Styles to allow controlling the default settings for the Navigation block. My hope was to merge this and continue to iterate and integrate with the Global Styles work. All that said, I do seem to be alone in this; I suggest we close this issue and move on. Maybe we'll come back to this further down the road. |
I guess we should probably land it as Global Styles first and then check if there is a need for per block customisation. Till then, there are 1-2 easy "hacks" ( css - adding it as menu without link). Thanks for your feedback on this, I am closing this PR. |
Fixes #23293
Description
None, / , • , |
) for horizontal navigation menu blocksHow has this been tested?
Manual Test 1
Result
None, / , • , |
) from the sidebar navigation block optionsNone
should not display any separator in the editor and in the frontendManual Test 2
Result
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: