How to make the Preview button automatically open new tab?

In the past year or so the Preview button does not automatically open the preview tab anymore, and I need to click another button to do that. Is there a way to skip this dialog?

Related: Shortcut for preview? | WordPress.org

Topic block-editor previews Wordpress

Category Web


The Preview button and associated functionality is currently undergoing a fair amount of iteration - I would imagine we will see a keyboard shortcut added, along with other options for modifying it's UI down the road.

A Big Hack

Interestingly, the old direct-preview button's component is still rendered, but is hidden on a > 600px media query. We can reveal the button again with a little CSS:

.edit-post-header__settings .editor-post-preview {
    display: block;
}

I wouldn't rely on this working indefinitely, however.

A Little Hack

For now, the most canonical solution would probably be to register a block editor plugin which renders a new <PostPreviewButton> component as a child of a <PinnedItems> slotfill.

It should be noted that doing this directly undermines the UX design for the <PinnedItems> slotfill and area, which is intended to show buttons for functionality which the user explicitly opts in to. Thus, were this to be distributed in a plugin, it would be a good idea to associate it with a toggleable editor setting.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.