amp.dev icon indicating copy to clipboard operation
amp.dev copied to clipboard

Playground renders itself into preview frame when an `<amp-lightbox-gallery>` is exited

Open alanorozco opened this issue 3 years ago • 6 comments

🐛 Bug Report

Current behavior

Playground renders itself into preview frame when an <amp-ligthbox-gallery> is exited

https://playground.amp.dev/?url=https%3A%2F%2Fpreview.amp.dev%2Fdocumentation%2Fexamples%2Fcomponents%2Famp-lightbox-gallery&format=websites

https://user-images.githubusercontent.com/254946/126695724-27dc8d82-3bb4-4e83-91e1-d38a7903f9f7.mov

Expected behavior/code

The preview document should remain displayed.

Reproduction procedure

Please provide the steps to reproduce the problem:

  1. Click on any image in the preview pane. A lightbox opens.
  2. Click on close (x) button at top-right of lightbox.
  3. Playground is displayed, nested.

(Chrome 91 / macOS)

alanorozco avatar Jul 22 '21 19:07 alanorozco

Investigated this a bit. This seems to be related to how AMP initializes history in iframes without src. Rendering the preview iframe using srcdoc instead of document.write fixes this problem, but then I'm running into the following error:

error-reporting.js:205 Initial replaceState failed: Failed to execute 'replaceState' on 'History': A history state object with URL 'about:srcdoc' cannot be created in a document with origin 'http://localhost:8081' and URL 'about:srcdoc'.

This has already been reported for AMP here: https://github.com/ampproject/amphtml/issues/35469

sebastianbenz avatar Oct 06 '21 18:10 sebastianbenz

The issue is still reproducible in amp-siderbar and amp-lightbox-gallery on the new Beta version 2303151621000

dzarmanova avatar Apr 03 '23 17:04 dzarmanova

@dzarmanova thanks for reporting! it is a different issue now than previously, I am hoping to get a fix out for this soon.

patrickkettner avatar Apr 03 '23 18:04 patrickkettner

@patrickkettner but I see the same issue that playground renders itself into preview frame when exited. For amp-lightbox-gallery https://photos.app.goo.gl/VHHQZS72Wwccktrd8 For amp-sidebar https://photos.app.goo.gl/4aBvk1nQTvi6muz48

dzarmanova avatar Apr 03 '23 20:04 dzarmanova

@dzarmanova yep! the issue is there. I just said (for anyone else reading this in the future) that the cause mentioned earlier in this thread are unrelated to the issue causing this issue.

patrickkettner avatar Apr 03 '23 20:04 patrickkettner

@patrickkettner got it, thank you for clarification!

dzarmanova avatar Apr 03 '23 20:04 dzarmanova