-
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
Responsive previewing and device-specific editing #19909
Comments
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. |
@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 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 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. |
See this comment for how the grid should work: #19254 (comment). 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.
The grid approach is also direct manipulation, can have sensible defaults and an immediately visible interface.
I wouldn't call it per-feature, per-block, it would just be limited to the grid.
You shouldn't be able to edit a grid at a breakpoint you're not previewing.
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.
Where did you see that proposed? I don't know how that relates to the grid approach.
Yeah, I wouldn't suggest this either. I think we are talking about different things.
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. |
|
✨ 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.
Good idea to explore. It's a little space constrained, but it seems like it should be doable?
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.
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. |
Related: #20244 |
This is a big issue. |
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. |
From Row Block: Add support for centering the middle item when the left and right are unequal:
It would be helpful to be able to show/hide blocks based on viewport width 😁 |
I feel like Gutenberg is doomed. I am sorry, i did not work on the wordpress core so far, so its easy to complain. Thx for all the hard work in advance. That said, i think its horrible, how the answer to every proposal around device specific controls is "have a better design philosophy". What kind of clients do you work for? Their websites must be ridiculously small and they must be super nice. I have clients that just want things to work in a certain way and i need these controls for it. Also browsers like safari for ipad, iphone have specific quirks that make it impossible to use some of the very advanced css for now. A medium sized companies website feels like a big hack. I need a theme, i am forced to use some part of their block bundle and another one, because gutenberg is way too simple. And then i wrote 6000 lines of scss. What the hell man? Apart from speed problems, because react is horribly slow (should be rebuilt with svelte), the lack of advanced, breakpoint specific controls is the main issue with Gutenberg. Do you know which users are most important in the decision making / for approving PRs related to this? |
It's now almost 4 years since this issue has been opened. It would be great to get some traction on it. I really want to use Gutenberg in a professional context and so much stuff is really coming along nicely, but the lack of responsive controls is a really big problem for some designs that I am confronted with. |
Check out the exploration here: |
I think all the ideas and explorations presented over the years look great and the majority of theme developers would probably be happy with any of them being implemented as a start. There have been lots of well thought out options for breakpoints and styles in theme.json, new controls in the Block Editor, and combinations of the two. That being said, the ideas being proposed today don't feel drastically different from the ones that were proposed 4 years ago. I don't think there are any new ideas left to explore after 4 years and I don't think anyone wants to spend another 4 years talking about where the ideal place to stick the dropdown for desktop/tablet/mobile is. If this is the direction the Block Editor is going, someone just needs to make a decision. |
There is a lot of movement around grids and that can also impact device specific editing. |
A suggestion on how to possibly move this forward in an iterative manner. The idea behind the States issue was to build a flexible approach to define the multitude of ways a particular pattern/block can be displayed depending on its state. That may be due interactivity like button hover, container width, or a user defined state that can be transitioned to. The proposal covers responsiveness by treating container width as a type of state. So the suggestion is that we start with patterns. When creating or editing a pattern in isolation, you can switch container widths (which you can currently do via preview dropdown), and any styles added within that width are applied from that width downwards. This makes use of container queries not viewport. It would also make use of the style inheritance work to highlight changes that are applied to a specific width. We want to encourage an intrinsic first approach to responsive design, but there will always be scenarios where adjustments are needed, particularly on more complicated sites that may exist in the enterprise space. I believe starting with patterns and container queries does not diverge from this principle. It also means patterns can be shared across themes with responsiveness built in. We can then move towards viewport level styles if it makes sense, but I imagine that introduces greater technical challenges. I would like to know the level effort to required to implement this starting point making the assumption we aren't touching any UI and just making use of the preview dropdown. It's worth doing a little tech spike into effort to better understand where this work might sit amidst all the other priorities. |
This is aligned with how theme designers I met imagine mobile-specific changes working. The UI changes when one switches from desktop to tablet and mobile, which is enough of an indication that the user is now in a different editing mode. To compliment this flow, we'd likely need some kind of control to let the user restore the default desktop layout in case they want to go back or make changes. In such case, we'd treat the desktop layout as the source of truth, which makes sense it's the default view that fills up the canvas when the user first enters the editor. |
I believe that mobile responsive options are essential. For instance, if a user wants a paragraph to be left-aligned on desktop and center-aligned on mobile (to improve mobile UX), it is currently not possible. If we want WordPress to stay ahead, this kind of attention to detail is crucial. Implementing these options will boost the adoption of new FSE themes. @mtias |
We have done some exploration with this. Screen.Recording.2024-11-05.at.23.40.31.mov |
@tomtev thanks for the reference! A few things that are left unspecified:
|
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.
Mockups
Next steps
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.
The text was updated successfully, but these errors were encountered: