Previewing Site Responsiveness in the Customizer

Note: This proposal was merged to core in [36532]. Download the latest nightly build and give it a try!

The customizer is a framework for live-previewing changes to WordPress sites. And by now, nearly every WordPress theme/site features responsive designs intended to look good on any device. Previewing site changes is just important on mobile as it is on desktop, to ensure that front-end user experience is exactly as intended.

Bringing these ideas together, #31195 proposes a new feature in the customizer that allows users to quickly preview their site on various device sizes. Here’s a quick walkthrough:

customize-device-preview

The proposed feature focuses on simplicity. The device previewer is in the customizer controls footer, near the “Collapse” button. Only three options are available by default, and they’re intentionally ambiguous. Rather than looking like specific devices, the intent is to understand what a site may look like on a roughly tablet-sized, portrait-orientation device or a roughly phone-sized device, in addition to the standard desktop view. A further extension in #34051 may allow larger screen sizes to be previewed on smaller devices with forced horizontal scrolling; for now, the feature is only available on larger devices.

For Developers

Along with this feature would come a couple of ways to customize the behavior. Please keep in mind that these are proposed and subject to change.

The new customize_previewable_devices filter lets you customize the devices available for preview. One use case may be to turn off this feature entirely:

add_filter( 'customize_previewable_devices', '__return_empty_array' );

Or, developers can add additional custom device preview buttons. The button element will be rendered and the appropriate JS applied to custom devices when the button is clicked; however, developers need to provide CSS to add an icon to the button and to react to the preview size changing.

In JavaScript, themes and plugins can react to changes in the device size being previewed with:

wp.customize.previewedDevice.bind( function( newDevice ) {
     // Do something to adapt to the new device being previewed.
});

This is particularly useful if your theme requires a JS trigger for responsive elements to apply, instead of using CSS solely.

Summary

Any feedback and testing is much appreciated. Device previews in the Customizer can be tested with the latest patch on #31195.

Comments are welcome on this post, the ticket (#31195), or our continuous chat in #core-customize on Slack.

#customize, #mobile, #needs-testing

Mobile Flow Update

Here’s the state of the open mobile flow tickets we’ve been calling out in the jumpstart posts.

#29989 Hide Media Buttons on small screens

I’ve really wanted this one for awhile. There was some good design momentum, but we’ve faltered as we moved to implementation. This ticket needs developer feedback. We really need these improvements to post-new.php for mobile.

#31187 Allow swiping the admin menu open and closed on touch devices

This one has gained some momentum. We need code review and testing. I’d really like to land this one.

#29906 Submenus can’t be dismissed on mobile.

During the first NUX meeting, the importance of the toolbar was called out by several. The toolbar needs help on mobile. There’s a working patch on this ticket that needs code review. There’s another case to cover that needs discussion and eventual patching.

#29993 Media action links are cramped on small screens

This needs a patch refresh and more discussion.

#29992 Cramped tag action links on small screens

This has a patch that needs CSS review and testing.

#15930 Make trashed posts/pages still readable

This is a possibly very simple patch that will remove a lot of frustration from certain flows. Read about one such flow.

#31233 Dismissable admin notices

This isn’t really a mobile flow ticket, but I like it enough to tack it on here as bonus. There’s a first pass patch on the ticket already. I’d love to see this go somewhere.

More here:

https://core.trac.wordpress.org/query?status=!closed&keywords=~make-flow

#4-2, #flow, #mobile

Improving Mobile Flow in 4.2

Over on make/flow, we’ve been flow testing core, posting visual records, and opening tickets tagged make-flow. During 4.2, we’re going to highlight a couple of these flow tickets every week, with an emphasis on mobile. Here is a small selection of mobile make-flow tickets to consider for 4.2. From log in, to the toolbar and admin menus, on to the editor media buttons, these tickets note some of the annoying little UX issues that impede flow on phones. Fixing these would improve our mobile flows significantly.

The logo header on the log in screen is too large a tap target
https://core.trac.wordpress.org/ticket/31185

Submenus can’t be dismissed on mobile.
https://core.trac.wordpress.org/ticket/29906

Hide Media Buttons on small screens
https://core.trac.wordpress.org/ticket/29989

Prevent device keyboard from displaying after selecting an image in TinyMCE
https://core.trac.wordpress.org/ticket/31162

Allow swiping the admin menu open and closed on touch devices
https://core.trac.wordpress.org/ticket/31187

If you’re curious about Flow and Visual Records, check out the sidebar on make/flow, the Flow Glossary, and the #core-flow Slack channel.

#4-2, #flow, #mobile

Tablets and Touch UIs in WordPress 3.4

We’ve had some terrific progress made in the realm of supporting touch interfaces and tablet UIs for 3.4!

The main areas that we’ve focused on for this release were improving touch support in the user interface, resolving incompatibilities for our target devices, and enhancing the UI’s methods for adapting to more restrictive screen sizes.

Target Devices

Our target devices for the 3.4 release were the iPad and the Kindle Fire. The iPad stands as an obvious choice, and the Kindle Fire’s steep climb to over 50% of market share amongst Android tablet devices justifies its presence as well.

Improving Touch Support

For touch-supportive devices, we’ve added a fantastic jQuery extension to the core, jQuery UI Touch Punch. This has enabled ‘drag and drop’ support on mobile devices. Whether editing a post, customizing the dashboard, or modifying a Nav Menu, you’re now able to easily reposition items on a touch interface to your heart’s content, just as you would on your desktop browser.

Caveat: Windows Phone Devices

Windows Phone 7/7.5 phones are wonderful devices. Unfortunately, when Microsoft based the phone’s web browser off IE9, they didn’t add in any touch support. As such, there is no way to detect touch events in the browser — `ontouchstart` doesn’t exist. Dragging support does not work on Windows Phone 7/7.5 devices, but should on Windows 8 tablets and phones when released.

Resolving Incompatibilities

This boiled down primarily to the Kindle Fire. The version of WebKit used in the Kindle Fire’s native Silk browser doesn’t support the contentEditable attribute, so TinyMCE wouldn’t work! To accomodate for this, we added an override to test for the version of webkit that the client is using, and just disable the visual editor if the browser doesn’t support it. This patch should also cross-apply to older versions of iOS and Android as well.

UI Enhancements

In Ticket #20015, we migrated the dashboard and write screen columns to use primarily @media queries, rather than the JS that had previously been used. This should provide some performance optimizations in mobile browsers.

The Tableteer team for 3.4 was comprised of Andrew Ozz, Zach Abernathy, and George Stephanis.

#android, #mobile, #target-devices, #ui-enhancements