-
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
Add support for device previews #11833
Comments
I think your third point is one of the most challenging here, from a design perspective. We're looking into something like this for some WooCommerce blocks we're working on and I keep going in circles on this particular point... Should it really be possible to preview "desktop" mode when editing on a mobile device? It sounds highly unintuitive, even with zooming. But you must also consider the idea that certain blocks might have different settings for different devices. As an example our Products blocks will allow authors to configure a layout for their product grids and that will likely vary depending on screen size. So it should still be possible to at least modify desktop-specific settings while editing on a mobile phone. But that is also awkward because you'd be editing settings without a visual preview which goes against what I consider to be a core Gutenberg concept. I'm curious whether you had any mockups of how desktop preview would look on a mobile device? |
That's exactly my fear. I've seen existing Gutenberg block plugins employ a similar pattern (desktop / tablet / mobile toggles for specific settings) with the lack of visual preview makes the whole experience feel disjointed.
Thanks for sharing this. Initially the duplicated icons confused me, but it makes sense as you explain it. I'm keen to test the zooming to get a feel for it. Is the theme publicly available at all? |
Related #13203 |
Is your feature request related to a problem? Please describe.
It would be nice to finally get some device preview support inside of the editor. I would image something similar to the customizer's device preview, with some filters to allow custom sizing for breakpoints to be added by devs. This could also pave way to a standard for allowing viewport based controls in core. In looking at various plugins - and even in core code - the approach has pretty much been all over the place as to how to handle this. Core's Media & Text block is an example of the current flexibility provided for viewport based controls:
There may be documentation about the media & text block and instructions for theme developers to add support for the mobile breakpoint out there, but this seems like something that should encompass more than just one block, and potentially set a standard moving forward for blocks and themes to better provide a fluid experience for users.
Describe the solution you'd like
Ideally I see something like this being useful:
Developers can register viewport sizes they wish. Most useful for theme developers who have different breakpoints set in their themes, but I could see plugin developers adding way to interact more in depth with various screensizes as well.
Device preview selections available to ALL devices.
The ability to zoom in/out on devices that are smaller than registered viewport widths. This would allow for accurate previews to occur for the editor regardless of a user being on a smaller device.
Detection of the device previewing the editor (based on viewport width). This would set the initial state when the editor is loaded, so any controls/blocks relying on the viewport sizes can properly display. If core or plugins wanted to set a default state to always a particular viewport on entry - then appropriate resizing/zoom could happen in the initial load of the editor as well. This is something missing from the customizer's device previews.
Core implementation to support large, desktop, tablet, and mobile by default - instead of just desktop, tablet, mobile (customizer). Large displays have become more common, and many CSS frameworks hit these four breakpoints, allowing developers implementing them that flexibility - so I would expect core to mirror the common use cases in that sense. It would also be nice to have a new dashicon to better fit interfaces for themes that do provide large viewport support in the customizer, and other places where it's been a common interface element for themes/plugin developers.
A uniform approach to controls that allows users to preview and make changes to different viewport sizes. This is a very common problem for WYSIWYG - and often times it's left to a developer to decide what the best fit for the content is based on what they had envisioned since there's no way for a normal user to interact with different viewport sizes easily. Developers, designers, and end users don't always have the same vision for content - and it's very common for an end user to ask after building a website how to hide a particular block/section/column on mobile/tablet/desktop. We should give them this power.
Describe alternatives you've considered
In terms of alternatives - the only alternative I've thought of is to not provide support for device previews, and leave this work to theme developers and/or plugin developers to handle. I don't think this is a very good route because it provides an inconsistent UI for end users when switching between themes/plugins. I also think it's a good indication that if core provided the media & text block, and saw in the initial implementation that they need to provide a "stack on mobile" option - that a better/consistent way of handling device previews needs to be available and implemented.
The text was updated successfully, but these errors were encountered: