Work ongoing in #19082 (see also mockups) has enabled previewing responsive changes to existing blocks. Specifically, it enables previewing content at three breakpoints, mobile, tablet and desktop. This opens up a number of questions and possibilities, one of which is: can we leverage this responsive preview feature, to enable responsive editing?
Examples of responsive editing:
This ticket shows some initial mockups exploring what that might look like. These mockups assume the following design constraints:
The above constraints make this ticket an alternative approach to #13363.
For the time being, the above flow shows how to:
This flow on its own should be portable to making any other changes, such as column changes, or even alignment or sidebar changes. So now is a good point to stop and revisit the ideas presented:
Pending your feedback, subsequent discussion points include:
Let's discuss.
A simpler alternative for achieving the same sorts of layouts that this feature would power could be to have two grid blocks with different children that show/hide at different breakpoints.
I worry that scaling these "responsive edits" to all possible types of edits like alignment/color/sidebar settings could get complicated and confusing fast.
I really like the idea of this and my mind is skipping into how this would work for global styles. I keep thinking of the final step being confirming what you've changed - but that's to explore another time.
I really like the idea of the 'notification' indicator and this is a good spot (dot joke) to explore what that could be regarding color and shape.
I worry that scaling these "responsive edits" to all possible types of edits like alignment/color/sidebar settings could get complicated and confusing fast.
@epiqueras That is a concern I share, but as I think about the individual pages and posts I've created for clients over the years, I see flexibility in what settings change per device being valuable. I also predict that on any given page, there won't be as many device-specific edits as we might fear. I wouldn't expect more than a few images changing/showing/hiding, headlines changing in style or content (by showing/hiding), and maybe a modification or two to make something fit better on small devices.
Because of the potential mental overhead of learning how to make these changes and recognize them, I think this feels like a v2 feature. Something we can design and get ready to implement, but perhaps save it for a few months after folks get familiar with basic full site editing.
@jasmussen Right now, I'm digging the overall flow. Some thoughts in no particular order:
Can't grids achieve all of that as well? Without introducing something new to learn.
In the case of variable columns-per-row, you can accomplish that at the theme (or global styles) level using CSS Grid.
I'm also concerned about the blue dot. I think it should look more like an interactive element and use an icon of some sort.
Also, the "List device-specific changes" toggle should be split out into its own control on a separate line.
Can't grids achieve all of that as well? Without introducing something new to learn.
Can you elaborate on how grids can solve this? While CSS grid can change broad stroke layouts at different widths, these changes are layout-only. Unless I'm mistaken, you could not hide a block just on the mobile breakpoint, nor could you set a 50vh min-height on the Cover block just for the mobile breakpoint, and a 100vh min-height on the desktop.
Think of these mockups as looking at what the editor could be in 2 years. This is an exceptionally difficult interface, the way to build it is to start with the vision, then work our way towards that.
In 2 years full site editing will likely be in a better place, themes might be block editor aware, media queries work in the editor, blocks can leverage element queries, and the theme stylesheet is loaded into the canvas directly. (Probably.)
What does responsive editing look like in that interface? That's the question the mockups shown have tried to answer:
It's only when a specific breakpoint needs to be adjusted from what it comes with by default, that you'd need to enter responsive editing.
Inversely, if we were to keep going down the per-feature, per-block approach to responsive edits:
Perhaps the biggest cost, in my mind, is the opportunity cost. We can't yet imagine what wonderful and crazy things users can build when everything becomes responsive-enabled.
The mockups shown here are early, in need of refinement. But they do adresss those challenges outlined directly. I would very much encourage additional ideas, but because this is a future thing, those ideas should address the same challenges:
As an example of how why those two principles are worth tackling, I worked on this Layout Grid block, where we added responsive controls using a dimension control, like so:
This was created for lack of a better interface, and it's a bad user experience in many ways:
I'm also concerned about the blue dot. I think it should look more like an interactive element and use an icon of some sort.
I tried using the classic multi-screen icon, but it added visual complexity and drew attention to itself in a way that was not conducive to the idea that _you don't have to make responsive edits_. The dot, on the other hand, felt like it immediately opened up the interface, and you've probably seen it many other contexts without even thinking about it:
In a way, the dot deserves better than to be called non-descript. It is an icon, and it means _there's something here for you to look at if you want to_.
Can you elaborate on how grids can solve this? While CSS grid can change broad stroke layouts at different widths, these changes are layout-only. Unless I'm mistaken, you could not hide a block just on the mobile breakpoint, nor could you set a 50vh min-height on the Cover block just for the mobile breakpoint, and a 100vh min-height on the desktop.
See this comment for how the grid should work: https://github.com/WordPress/gutenberg/issues/19254#issuecomment-578190112.
You can hide a block on mobile by putting it in a grid that does so. And you can show different subgrids with different cover blocks to achieve that min-height difference.
What does responsive editing look like in that interface? That's the question the mockups shown have tried to answer:
The grid approach is also direct manipulation, can have sensible defaults and an immediately visible interface.
Inversely, if we were to keep going down the per-feature, per-block approach to responsive edits:
I wouldn't call it per-feature, per-block, it would just be limited to the grid.
You would lose the direct manipulation. You might be making edits to the tablet layout for a grid, while previewing at a desktop breakpoint. You might think you were also making tablet-only changes to content inside the grid, when in fact those changes are global.
You shouldn't be able to edit a grid at a breakpoint you're not previewing.
You would have no simple way to see a list of all responsive edits made to a page, or post, or template. You'd have to hunt through every block at every breakpoint to debug a change, which would be further confusing in case of blocks that come with smart defaults.
It would be simpler to see and display because the scope is limited to grid blocks. With the idea in this PR, any minor edit can be subject to the behavior.
You would essentially be white-listing every property and change that needed to have responsive edits, increasing the block API surface and putting the onus on block developers to decide which properties are surfaced as responsive.
Where did you see that proposed? I don't know how that relates to the grid approach.
Specific to the dimension control, this is a sidebar-only interface, limiting the type of properties you can enable responsive edits for, and further distancing it from the direct manipulation interface of the block itself. This also means any feature not in the sidebar, would need another interface, actually another thing to learn.
Yeah, I wouldn't suggest this either. I think we are talking about different things.
As an example of how why those two principles are worth tackling, I worked on this Layout Grid block, where we added responsive controls using a dimension control, like so:
Yeah, that is not ideal and probably why you rejected the grid idea.
You should not be able to edit a grid for a breakpoint you are not previewing. Furthermore, grid inner blocks should be the same between breakpoints. What you can set are two breakpoints for the grid: one at which it starts to render blocks in a list, one at which it starts to render blocks in a grid layout. Setting one of those breakpoints can change your preview to that size to see the change in action. Combining multiple grids that either hide, stack, or display typically at different breakpoints with different children can let you achieve any layout you can think of while maintaining all of the properties we want for the editor.
The problem with making all edits responsive is that we don't even have a definition for how an edit can be made or what they represent. They can be done programmatically by block developers; they can be done in an infinite number of different possible UIs. I can't even begin to think about how to surface all of them without ending up with some cluttered edited properties list that is hard to parse. Have you ever seen another editor that takes this approach? It might be helpful to see how others deal with it.
You’ve done this by adding a line of text to the breadcrumb bar. But I’m wary of putting more into that bottom bar; People rarely notice it, and the breadcrumb list could get very long and break the alignment. Maybe this indicator should live in the top bar as a new element next to the view menu, or a variation of the view button itself. (I know, adding more to the top bar might be a bad idea.)
✨
Great observation. There might even be an opportunity here to unify what pattern we come up with, with the Code Editor which currently has an "Exit" bar at the top.
Using the dot next to the device name in the menu seems a little strange. Its kind of mysterious. I wonder if using a label would be more clear. Something like “3 edits”.
Good idea to explore. It's a little space constrained, but it seems like it should be doable?
Visually, I find the hidden block to be too strong. But that’s minor. Conceptually, I don’t love that the block still displays something and takes up space in the canvas when hidden.
Good thought. This comment surfaces a challenge I had not considered, the case where the hidden block should not affect the _layout_, which a placeholder like this would do. Imagine hiding the 3rd menu item in the navigation block just on mobile.
I wonder if there could be a way to completely remove it, and add a button somewhere saying “show 2 hidden blocks”
This seems very much worth sketching out, because with your point very well made, the challenge becomes creating an obvious interface for unhiding those blocks when you need to.
Thanks all for the feedback, and keep it coming. The feature outlined here is a ways out, so let's keep the ticket open to additional input.
This is a big issue.
Should we break this issue into more actionable issues (or a test PR)? As it will create an easier focus on smaller features.
As we need to figure out an easier way to get movement here.
A block I'm working on, Layout Grid, will change the viewport when you select a responsive option in the sidebar — incoming feature. Testing the experience on that plugin sheds quite a bit of light on the various bit and bobs we can consider here.
Most helpful comment
A block I'm working on, Layout Grid, will change the viewport when you select a responsive option in the sidebar — incoming feature. Testing the experience on that plugin sheds quite a bit of light on the various bit and bobs we can consider here.