WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#53948 new defect (bug)

Missing View Post from Admin Bar AFTER Publish (not update)

Reported by: vondelphia Owned by:
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Toolbar Keywords: has-patch
Focuses: Cc:

Description (last modified by sabernhardt)

This creates a broken flow during development by forcing user to refresh page after publisher. This was not the case for the older GUI. You could just click publish and see Admin toolbar menu item "View Post" popup.

Adding a new Post / Page and clicking publish does not show "View Post" in admin bar UNLESS you refresh the page. The bottom left corner tooltip-like popup is not very good.

  1. Log in WP Admin
  2. Create new Page / Post
  3. Click Publish
  4. "View Post" is not visible in admin bar

Attachments (2)

53948-admin-bar.php.diff (2.3 KB) - added by sabernhardt 5 weeks ago.
creating hidden placeholder link
53948-show-link-on-pageload.diff (2.1 KB) - added by sabernhardt 5 weeks ago.
second option: show preview link when page loads

Download all attachments as: .zip

Change History (5)

#1 @sabernhardt
6 weeks ago

  • Component changed from General to Toolbar
  • Description modified (diff)
  • Keywords needs-patch added

Hi again and thanks for the ticket!

The classic UI automatically refreshed the page when publishing, and the block editor does not.

I have seen at least one report about this before, but that was apparently on the Gutenberg repository (GB20309 is one and GB31915 points to two other issues).

Perhaps the admin toolbar could include a placeholder div when creating a new post, so the block editor can replace that with a View Post link at the time it's published.

Last edited 6 weeks ago by sabernhardt (previous) (diff)

@sabernhardt
5 weeks ago

creating hidden placeholder link

#2 @sabernhardt
5 weeks ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 5.9

In 53948-admin-bar.php.diff, I chose to hide the View Post link on page load because the link does not resolve yet. This would still require removing the hidden class when the editor publishes (and/or autosaves) the post.

On the other hand, the Permalink section already shows the same preview link when the page loads. If it's better to show the link immediately in the toolbar as well, the meta class line could be removed. Then the link should not need any editor script or hook.

I preferred setting the ID to 'view', though 'preview' might make more sense because it starts with the preview URL. Either option updates the URL when clicking Publish.

Last edited 5 weeks ago by sabernhardt (previous) (diff)

@sabernhardt
5 weeks ago

second option: show preview link when page loads

#3 @sabernhardt
5 weeks ago

The second option 53948-show-link-on-pageload.diff is simpler, though perhaps not better. If someone clicks that link before the post is (auto)saved or published, it would result in a 404 error.

The same error already happens with the sidebar Permalinks section's link, but the toolbar is more prominent (when not hidden in fullscreen mode).

And for this patch, I used the 'preview' link ID and its target.

Note: See TracTickets for help on using tickets.