Navigation block: adds in default and style variation#18553
Conversation
88d004f to
7cb643d
Compare
|
This is now ready to review as I will work on iterations later. It would be great to get in along with experimental flag being removed. |
|
The styles appeared but switching showed no difference (using the TwentyTwenty theme) although I see there is some styling present for the dark style. |
|
@draganescu can you code review as I think this can be easier worked out with #18466 - which doesn't work on this branch. Or if there's a way to get that picked up on branch I think we can get this working. In my testing I was forcing the class as no it doesn't seem to pick up. Any help there would be ace. |
| & > li > ul { | ||
| margin: 0; | ||
| position: absolute; | ||
| background: #fff; |
There was a problem hiding this comment.
I think it is correct to remove this background, because it is not "light or dark theme aware".
But it does mean that a theme like TwentyTwenty now looks like this:
Compare that with this before:
This is a tricky one, because the white background assumes a link color that has contrast with that which might not be the case. On the other hand just floating there is also a bit off. Any ideas?
There was a problem hiding this comment.
Note that I tested TwentyTwenty because it does not opt in to "opinionated styles", and your PR here correctly relegates most of those styles to be actually opinionated.
| background: #fff; | ||
| left: 0; | ||
| top: 100%; | ||
| top: 80%; |
There was a problem hiding this comment.
This moves sub-nav closer to the navigation.
| list-style: none; | ||
| } | ||
|
|
||
| ul > li > ul { |
There was a problem hiding this comment.
I'm 90% sure that this is necessary because menus can nest deeply, so you have to be specific in targetting. But are there any CSS classes you can use to target this instead? Like, will .wp-block-navigation-item > ul work?
The fewer items in selectors, the better!
| } | ||
|
|
||
| ul > li > ul { | ||
| background: #e3e3e3; |
There was a problem hiding this comment.
I think this is good. But if the goal is to make it stand out from the background, it won't work if the background is also gray :)
So we can either embrace that it might blend in, in which case I'd personally love a sliiiightly lighter gray.
Or we can do something like add a shadow, gasp:
Up to you!
|
|
||
| ul > li > ul { | ||
| background: #e3e3e3; | ||
| border-radius: 4px; |
There was a problem hiding this comment.
I wish we had some sort of system for cataloguing these opinionated styles. Like, a consistent coherent visual identity for all WordPress opinionated styles that blocks can opt into. Right now they are kind of designed in isolation, but it'd be nice to have a system similar to the variables sheet we have for UI.
Things like color variables, border radii, paddings, etc. Not for this PR, but CC: @ItsJonQ as I think you've been vaguely exploring things like these?
There was a problem hiding this comment.
@jasmussen Ah yes! I outlined my idea here:
#9534 (comment)
jasmussen
left a comment
There was a problem hiding this comment.
I left some comments, but this seems like the right approach:
- It adds the designs as style variations you can choose from.
- It embraces the theme.scss file because they are opinionated styles.
- Code seems good, works well.
There's still the accessibility challenge of tabbing through the menu items, but that's separate.
There's an issue with the variation preview itself:
I don't know what we can do here. I know we can provide some default example content here, Image block does that, but the change is only visible when the mouse hovers the menu item, which doesn't show up.
@gziolo can we show not the nav block but JUST the submenu here? I.e. custom markup for the preview?
FINALLY I think there's an open question whether this PR should make THREE styles.
- Default: which is just the white background I commented on, and nothing else.
- Light: the gray bubble
- Dark: the dark bubble
This gives a little choice?
Something to think about.
I didn't follow the progress on Navigation block so I don't think I can help without taking a deep dive. I'm also attending WordCamp this week so I'd suggest asking someone else for help. |
|
Took this for a spin again, and I think I have an idea for a good path forward. However for some reason I can't get the styles to work anymore, not sure why. The code looks right, but for whatever, However, once that is fixed up, I think you should do these things to get this shipping:
Does this make sense? What do you think? |
This sounds great. Thanks so much. @youknowriad are you able to or someone else help fix through the issue here?
|
|
I think the default style should be called "Light". |
Sounds great, once through this class not showing issue will do that. |
|
Pushed a fix for the frontend className generation. |
Start of fixing #18552
… into try/nav-styles Brings a default to this but still has issues with mobile styling and also unsure what belongs in theme or what style to allow for variations. @jasmussen love your feedback on this approach. I can only think of this to have a default for Twenty Twenty being white with box-shadow. What seems to still be issue is the class being passed and it changing.
071e7ca to
97a83aa
Compare
|
I also rebased to fix some conflicts. |
|
Thank you so much @youknowriad, you are ace! I will pick it up and do the other little things. |
- Includes a fix for padding - Makes default light - Moves all to styles.scss to avoid Twenty Twenty issues.
Chrome in screenshot was showing bottom border out on arrow. Fixed now. Props @mtias for noticing 🙌🏻
Reduces on lines themselves and adds wrapper spacing within navigation when sub panel.











Start of fixing #18552. The light style is a light grey to avoid it not being visible on light without a border. This is a very simple bubble drop down with a gentle arrow.
To do: