Skip to content
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

Post Preview modal no longer loading #54018

Closed
mrfoxtalbot opened this issue Jun 25, 2021 · 21 comments
Closed

Post Preview modal no longer loading #54018

mrfoxtalbot opened this issue Jun 25, 2021 · 21 comments
Labels
[Feature] Post/Page Editor The editor for editing posts and pages. [Pri] Normal Triaged To be used when issues have been triaged. [Type] Bug User Report This issue was created following a WordPress customer report

Comments

@mrfoxtalbot
Copy link

We have noticed that Calypso's modal is no longer loading. Instead, users are taking to a preview in the "front end" (as if they were using the WP-Admin editor instead), for instance:
https://example.wordpress.com/?p=1234&preview=true

Screen.Recording.on.2021-06-25.at.11_23_25.mp4

Is this intended, or is it a regression?

@mrfoxtalbot mrfoxtalbot added [Type] Bug [Feature] Post/Page Editor The editor for editing posts and pages. User Report This issue was created following a WordPress customer report labels Jun 25, 2021
@mrfoxtalbot mrfoxtalbot added this to Needs triage in HE Triaging Board (new bugs) via automation Jun 25, 2021
@mrfoxtalbot mrfoxtalbot added the Triaged To be used when issues have been triaged. label Jun 25, 2021
@mrfoxtalbot mrfoxtalbot moved this from Needs triage to Triaged in HE Triaging Board (new bugs) Jun 25, 2021
@AlexanderMonsanto
Copy link

Possibly related ticket zd-4094204

@devNigel
Copy link

Here's another case

User report: 30098471-hc
Ticket: 4093594-zen

@AlexanderMonsanto
Copy link

Another ticket: 4094525-zen

@hngdny
Copy link

hngdny commented Jun 26, 2021

Possibly another one here: 4094244-zen

@kriskarkoski
Copy link
Contributor

I believe #4097705-zen is related to this. I had an additional report as well before realizing this was the issue that I'll add if/when I find it. In my testing the modal loads but the preview also opens in a new tab on the first attempt.

In this case the user is seeing Page Not Found in the window that opens. Maybe a third-party cookie issue where they're not logged into the site that our change to logins to custom domains might help?

@kriskarkoski
Copy link
Contributor

#4097787-zen

@kriskarkoski
Copy link
Contributor

4098156-zen

@ktyfuller604
Copy link

Similar report here, they got a page not found when previewing a scheduled post. #2347495-hc

@kwight
Copy link
Contributor

kwight commented Jun 28, 2021

The "page not found" seems to be transitory (at least the time I saw it); "page not found" would flash, then the correct post would load.

@kwight
Copy link
Contributor

kwight commented Jun 28, 2021

I'm labelling this as "normal" because it's an obviously broken WP.com experience, but it has reverted to WP core behaviour of opening in a new tab (which works most of the time?). There are no recent ETK, wpcom-block-editor, or Calypso changes that would seem to account for it.

@kwight kwight moved this from Triaged to Prioritized in HE Triaging Board (new bugs) Jun 28, 2021
@the-misha
Copy link

the-misha commented Jun 28, 2021

4097219-zd-woothemes

EDIT: This seems to be an issue for posts in Draft, as I'm able to preview Published posts without an issue. Also, if I select Preview from the "three dots" menu from the Posts page, I can preview the post without issue.

@joweber123
Copy link

I have created three how-to-videos to show how a user can use the responsive design mode in Safari, Chrome, Firefox as a workaround while this is being fixed.

Safari How-to-Video - https://d.pr/i/44ySht
Safari Guide - https://developer.apple.com/safari/tools/

Chrome How-to-Video- https://d.pr/i/fPArfd
Chrome Guide - https://developer.chrome.com/docs/devtools/device-mode/

Firefox How-to-Video- https://d.pr/i/td6SVJ
https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode

@rezzap
Copy link

rezzap commented Jun 29, 2021

Another report of this in 4099282-zen seeing the "page can't be found" report. I'll gather more details before providing how-to guides.

@jsnajdr
Copy link
Member

jsnajdr commented Jun 29, 2021

This is what I found when debugging this:

Natively, the button.editor-post-preview click event is handled by the openPreviewButton method in Gutenberg. That method opens the preview in a new tab. When I'm testing in Calypso iframe, this method is called, although it shouldn't be (see below). And it crashes with an exception:

Blocked a frame with origin "https://jsnajdrtestsite3479.wordpress.com" from accessing a cross-origin frame.

That exception is thrown in the writeInterstitialMessage function which uses document.write to write a temporary message into the preview tab document. Apparently this cannot be done in a Calypso iframe.

Calypso iframe is supposed to override the native method by registering its own click handler for button.editor-post-preview here. That handler is supposed to run before the native one, open a Calypso preview, and prevent the native handler from running by calling stopPropagation().

But although the Calypso handler is registered, it never runs. I suspect it's because the order in which they are registered was reversed recently. Both are on the same element: the div#editor one. The Calypso handler attaches it to div#editor explicitly, and because div#editor is the React root where the editor is mounted, the button.editor-post-preview handler actually runs on this element.

Why is the order reversed? Because Gutenberg upgraded from React 16 to React 17 two weeks ago in WordPress/gutenberg#29118. And that major version changed where React attaches its event handlers. The native openPreviewButton handler that we want to override used to be registered on document, being safely preceded by the overriding handler on div#editor, but now they are on the same element and their order is reversed.

@KokkieH
Copy link
Contributor

KokkieH commented Jun 29, 2021

@AlexanderMonsanto
Copy link

possibly related zen-4094525

@pablinos
Copy link
Contributor

I've just deployed #54127 that fixes this issue, so I'm closing it.

HE Triaging Board (new bugs) automation moved this from Prioritized to Closed Jun 30, 2021
@KokkieH
Copy link
Contributor

KokkieH commented Jun 30, 2021

Can confirm it works for me now.

@jtobiesen
Copy link

Found a ticket that seems related. 5413341-zen

User is reports being redirected to a page not found when previewing a draft post.
Workaround- User can preview draft post from the the All Post screen in WP Admin

Customer using:


  • Firefox browser 102.0.1
  • 
Also in the private browser on Opera

@github-actions
Copy link

Support References

This comment is automatically generated. Please do not edit it.

  • 4093594-zen
  • 4094525-zen
  • 4094244-zen
  • 4097705-zen
  • 4097787-zen
  • 4098156-zen
  • 4097219-zen
  • 4099282-zen
  • 5413341-zen

@carinapilar
Copy link

In reply to @jtobiesen's comment above, it seems that the issue from that user specifically is related to this other GH thread instead: #57812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Post/Page Editor The editor for editing posts and pages. [Pri] Normal Triaged To be used when issues have been triaged. [Type] Bug User Report This issue was created following a WordPress customer report
Development

No branches or pull requests