amp.dev
amp.dev copied to clipboard
Playground renders itself into preview frame when an `<amp-lightbox-gallery>` is exited
🐛 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:
- Click on any image in the preview pane. A lightbox opens.
- Click on close (
x
) button at top-right of lightbox. - Playground is displayed, nested.
(Chrome 91 / macOS)
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
The issue is still reproducible in amp-siderbar and amp-lightbox-gallery on the new Beta version 2303151621000
@dzarmanova thanks for reporting! it is a different issue now than previously, I am hoping to get a fix out for this soon.
@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 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 got it, thank you for clarification!