-
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
Experiment: try Theme JSON API to control block orientation #33044
Conversation
Size Change: -793 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
There's now #33359, which might change things considerably 😄 |
yes, with #33359 the "layout" can be defined with theme.json as well. For a "default" layout container, it doesn't make sense to be able to define the "orientation" (in fact that PR considers the The main driving principle though is that "layout" should be declarative, meaning the fact that right now we need to start moving away from CSS used to style how inner blocks are aligned (navigation, buttons, social links, columns). Instead, blocks should choose a layout and the style comes with it, some blocks (like group, navigation) could allow changing layout, allowing a subset of layouts... By making all these things declarative, we can adapt the block editor UI to the selected layout and we can also allow theme.json to define the global layout (not sure yet about specific blocks because these are supposed to be customized in the templates instead). |
TBH if Theme JSON takes over layout then this PR isn't required. The objective of this PR is a PoC to explore whether we can utilise Theme JSON to control Nav Block features. The rationale behind this effort is detailed in #30007 (comment). I might well pick another facet of the block to "tweak" instead. |
Description
This is a experimental PoC PR to see if it's possible/suitable to utilise the Theme JSON API to control a block's
orientation
via a Theme JSON setting.This is part of a wider exploration to see if it's appropriate to use Theme JSON as a mechanism to control block features.
See #30007 (comment) for context.
Questions
There is much to think about here.
Is using an open array the best option or should you have to pick from predefined options (eg:I think it's better to have limited options.vertical: true
,horizontal: true
...etc).How has this been tested?
Site Level Orientation
theme.json
file in your theme to have the following key under the top levelsettings.layout.orientation
:vertical
mode because you allowed that in the Theme JSON.Block Level Orienation
Now let's try making this setting apply to the Nav Block only.
theme.json
.settings.blocks.core/navigation
- it should look like this although be aware you may have other settings already present so you will need to be VERY careful about where you place this code otherwise it won't work:vertical
mode because you allowed that in the Theme JSON.Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).