Try cascading nav styles through classnames#37473
Conversation
|
Size Change: +792 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
|
Thanks for the PR! To me this feels like a good pragmatic step forward. Justifications in a classname affords the same opportunities inheritance does, but a bit more flexibility and simplicity, I think it works well, and in a quick testing, justifications are working across the board for the navigation block. Nice! Could we change the classnames from |
youknowriad
left a comment
There was a problem hiding this comment.
This is a great approach. Close to what I had in mind with the "no-filters" approach. 👍
| } | ||
|
|
||
| // Custom properties for layout style cascade: default values. | ||
| --layout-justification-setting: flex-start; |
There was a problem hiding this comment.
Can we make these CSS variables more specific to the navigation block or something? They feel a bit too generic.
There was a problem hiding this comment.
Done! I prefixed them with "navigation".
|
@jasmussen the classnames we're using here are the |
|
Sorry about that, and thanks for the pointer! I guess this one just needs a code review and a green light. |
|
I think the layout justify classnames are also being removed cc @ntsekouras. |
Yes, that PR will be reverted. |
* Move layout custom properties to filter. * Try cascading nav styles through classnames * Improve formatting. * Remove hook * Fix PHP lint errors. * More specific variable names
Description
Alternative to #37438. Instead of adding custom properties to layout, classnames are added to the navigation block wrapper and custom properties are hooked to those classnames.
I think this is neater than adding the custom properties as inline styles, because this way they live in a single place - the stylesheet - instead of being duplicated across JS and PHP files. Also, we're already generating a couple of the justification classnames anyway, to attach submenu styles.
How has this been tested?
Create a Navigation block; change justification/orientation and verify everything works as expected in both editor and front end.
Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).