-
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
More Block Tools and APIs for container blocks. #27324
Comments
Or at the global level. One big concern I have with giving users so much control is that they are being empowered to make ugly sites by having slightly different settings for every block. It would be interesting to explore making the default interactions on a block modify the global styles for that block rather than the specific instance. |
Just to note, I think the "in some cases" is quite important there. Sometimes those intermediary blocks are useful, indeed I would rely on them if I wanted to create a design like this: |
The second column block in that screenshot is useless, why the "sidebar template part" doesn't represent that column. |
For the layout & nesting issues, wouldn't a "grid" block as initially proposed in #18600 help? It could be used as a simple columns block, or it could take care of the whole layout from the screenshot above... If we had something like that, then it could easily accommodate most scenarios we may encounter now and in the future. A wrapper would be added only if there's multiple items in the same in the same area - in which case they'd need to be "grouped".
That would indeed be very interesting. It would bridge the gap the global-styles (which are only available in the site-editor) and the post-editor, and it would promote consistency. 👍 |
Fair, the second column is probably not needed, but some representation of the first column would be needed to add the different background color. @aristath A richer grid block could help for sure. But I wonder if the grid/layout should be defined at the template/document level as well, perhaps via global styles? That way any block added to the document will always have some sense of consistent spacing, and creating layouts like the one above would just be a case of dragging those blocks in to position – no need for grid/column blocks. I think @jasmussen has been looking at this. |
Great ticket.
Beautiful articulation, and I strongly agree — the more containers we can "abstract away" or make invisible, the better. While it's important to improve the select-parent flow, simply removing parents is a sure-fire way of improving this. I recall discussing how to build a better Table block with @talldan recently, and he had some great ideas on that.
There's a separate ticket for exploring improvements to selecting the parent block in #26313, and I shared some initial work in a comment #26313 (comment): Those two mockups target the canvas experience at a high level. With regards to showing child sidebar(s) when a parent is selected, vs. showing parent sidebars when a child is seleced, this is really tricky as you might have, well in a gnarly case, tens of different child blocks inside a group, and showing them all is tricky. But to get the ball rolling, here's a mockup showing a Cover block with a Paragraph inside, and how you might use the sidebar to go back and forth between them: I'm not 100% feeling it, but I think it might serve to enable better ideas. The problem is, I don't think we can ever show all the sidebars stacked on top of each other — we have to collapse either the parent or the child, and at that point we might just as well select the parent and/or child when expanding them. I took a little bit of inspiration from Figma on this, where selecting the parent you can see the "styles" of child elements: See also how when there are more than n children, some of them are collapsed. Also note, some of the sidebar work here is inspired by #27331. |
Inner containers is a problem I also highlighted here #29228 |
I was thinking that if we allow any block to become a section capable of overwriting the global styles of their children (as described in #39281), then the question of how to apply the same style to all the button blocks at once pretty much disappears (issues like this or this). Actually, draging and dropping a button block from one set of buttons to another will automatically change its style (it will match its new siblings). |
Yep, it could have a series of neat cascading effects. |
@youknowriad do you think we can close this? It seems other issue are more relevant these days. |
Yes, I'm going to close this. Personally I think the missing thing is the "unification" of the position attribute. I've expanded here though. So let's close in favor of this one #8288 (comment) |
As we move forward with Full Site Editing, and explore adding customizations options to several blocks, we're starting to notice that the current APIs and interactions for container blocks are less than ideal. We might be missing some abstractions there to achieve several use-cases:
Layout
We have several blocks that are "flex containers". I'm thinking of columns, navigation, social icons, buttons. There are several common issues that are highlighted in these blocks:
Yet, all these shared properties are implemented in an Adhoc way. Styles are duplicated, width config is duplicated, ...
Alignments
This is particularly visible for FSE themes but it's a global issue. When you add a container (group block or a column block), sometimes the area is too narrow and you don't want the same alignments options available at the global level to apply. Also, if different areas of a page/template/content can have different kind of alignments (think sidebar, content area), how does a user "define" what alignments are available inside this area? How to avoid the "global alignments" styles to apply?
Nesting
This is another issue that is particularly visible in FSE but may exist elsewhere. Take a look at this screenshot.
On the side, you can see the hierarchy of the page. One thing that stands out is that there's a deep level of nesting where sometimes it might not be needed. Why the first column is not directly the "single post" template part and the second ne not the "sidebar" template part. Why do we need intermediary blocks (column) while a template part is a simple container just like column and could just replace it in some cases.
Customizations
This is another important use-case that we're starting to see as we add customization options.
This raises the question of surfacing common customization tools for children in the parent block and the opposite too, how to surface the parent options in the children (or if we should surface them).
--
These are some of the challenges we're facing now and solving them would improve the experience greatly.
Potential solutions
1- To solve the layout and alignment issues, I started introducing the "layout" prop to "InnerBlocks". For now, it's almost an empty bucket but the goal is that applying a given layout type to a container automatically adds the styling and the positionning and common options to their child blocks. For instance, if I set the "buttons" container as a "flex" layout, automatically, it will get a classname to style it properly and its children blocks will see the regular alignments being disabled and a "position" attribute added where you can customize the position of the child block in that particular context (for instance set a width). This same abstraction ("layout") could allow us to solve the FSE issue of defining alignments for given areas. For instance we could imagine a "grid" layout where could have ways to define "wide"/"full"/"center"/"side" alignments using grid configs and have these styles generated automatically for the containers and also available for the child blocks (saved in the "position" attribute).
2- For the solution to surface controls between parent and child blocks, we do have an experimental way of doing that but it's not ideal. I'd love some design explorations there before trying to come up with the best abstraction.
--
cc @WordPress/gutenberg-core @aristath @vindl @jameskoster @kjellr @scruffian
The text was updated successfully, but these errors were encountered: