-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Implement new design for sub-menus #19681
Conversation
e7abf4a
to
96bce70
Compare
aae0082
to
7b7db07
Compare
background-color: $dark-style-sub-menu-background-color; | ||
} | ||
} | ||
|
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.
Are these styles going to be portable to the front end and shared?
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.
Are these styles going to be portable to the front end and shared?
Probably(?). I left the code there in case it doesn't set up background color. Guessing that transparent could be a problem. So it will apply the default background-color as long it doesn't already define a custom one.
Something to keep discussing, btw.
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.
Something like this:
// No background color - Default / Light styles
&:not(.has-background-color) .wp-block-navigation-link > .block-editor-inner-blocks {
background-color: $light-style-sub-menu-background-color;
}
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.
I was talking about all the styles, not just the lines above. I was hoping we'd have a single stylesheet that can apply navigation structure to both the editor and the front end. Colors could be separated so they apply even in situations where you've set a different block style in the future and the structural look is totally different.
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.
... was hoping we'd have a single stylesheet that can apply navigation structure to both the editor and the front end.
That makes totally sense to me. Let's find a way to isolate and consume these from both sides.
position: absolute; | ||
right: 0; | ||
top: 50%; | ||
border-left: 4px solid transparent; |
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.
Can we consider using an icon or char instead of a border technique? Keep in mind that, at least for now, we have only two ways to apply colors: color
and background-color
. Applying border-color will be a pain.
We can use dashicons or even SVG.
:this: is no true, we can propagate the text color from the Navigation block and apply the border color with the same value.
c6a7c66
to
aeeec37
Compare
min-height: $navigation-min-height; | ||
align-items: center; | ||
|
||
> .wp-block-navigation-link { | ||
display: flex; | ||
min-height: $navigation-min-height; | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
} |
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.
@frontdevde, not sure if it's the correct implementation. The idea behind this is to fit the .wp-block-navigation-link
in height to its container.
@shaunandrews Do you think you'll have a chance today to try out these changes? |
This is starting to come together nicely! I think it could use a design lookover, especially around padding, borders, and spacing both in the editor and front end. |
@@ -271,12 +267,18 @@ function register_block_core_navigation() { | |||
'customTextColor' => array( | |||
'type' => 'string', | |||
), | |||
'valueTextColor' => array( |
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.
Which "value" is that? Could we find a more descriptive name here?
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.
This value (already removed) came from the use-colors hook. I had modified introduced the ability to set up this attribute from there, too.
The reason was to be able to pick up the color value of the text, independently if it was defined using a custom color or a palette color, to apply to the border-color property.
I've removed all this stuff and replaced it using the CSS currentColor property.
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.
I've restored these changes. Going to explain why in the use-colors hook change.
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.
Basically this attribute will store the color value beyond how it was defined, either picking up from the colors palette or using the custom color panel.
…er with whatever the selected background color is.
…> level so links are now full width and everywhere in the menus is hoverable/clickable. Focus rings look nicer now too.
… width. This means that long submenu items will wrap. I also set a lower line height on items so that it was more obvious that a wrapped submenu item was one item,
84d4d56
to
a039f32
Compare
…dPress/gutenberg into update/navigation-submenu-new-design
Thanks, folks for reviewing and helping with the development. 👍 |
Description
This PR improves the sub-menus for the Navigation block. Significant changes:
Apply the border-color getting its value from text color (to be defined/under discussion)Fixes #18310
Design
The final design to implement on this PR was defined in #18310:
About technical implementation
We need to keep in mind that this PR propagates the color values from the Navigation block to each Navigation Item. It simplifies applying the styles via CSS, and get ready the code to apply custom colors to sub-menus/sub-items.
Tasks on this PR:
How has this been tested?
Screenshots
Types of changes
Checklist: