You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Site Editor canvas preview goes blank after saving post style changes #80262
Using Gutenberg and Core trunk on Playground (use this link), I noticed some oddness where after saving after making some style changes (responsive styling or hiding a block) where the canvas preview would suddenly go blank after saving.
Here's an example of what I see in the console in case it helps:
I'm not entirely sure what's going on but to replicate make some responsive styling changes, save, and see if the canvas properly renders a preview. I tried replicating after doing non responsive style changes and couldn't.
Something I notice is that the preview completely reloads, even when its already showing the same content, so an optimization could be to not do that 😄
I saw the same error is mentioned in this PR - #75619, but that's somewhat old and seems related to react strict mode, which I don't think would be active in the playground.
@annezazu I haven't been able to reproduce. Could you provide some extra information?
Does it happen in any browser?
Does it happen with no browser extensions? e.g. in an incognito/private tab
Are you only able to reproduce this after making specific types of edits (e.g. responsive style changes)? I wouldn't rule anything out, but to me it seems unlikely to be related to responsive styles. Perhaps likelier to be related to having just saved the template, or some kind of race condition where the saving completes while loading the iframe.
While we could implement some defensive coding, I think a reproduction for this bug will be important to successfully prove that a fix works.
When I tried to manually execute the repro steps, I took long enough to do them that I got the blank page and
Uncaught TypeError: Cannot destructure property 'documentElement' of 'N' as it is null.
at HTMLIFrameElement.I (index.min.js?ver=4b2c4bdfdd0eedf5e84b:122:927)
at the Design > Identity step, so the repro seems unnecessarily complicated (I had codex update the repro instructions; the old instructions are still there below the updated instructions).
Codex also produced a playwright test that repros the issue, but it's a bit odd in that it appears to actually connect to the playground URL instead of reproducing locally, which is what you'd want in a test. Let me see if I can get it to produce a more reasonable test. FWIW, here's a video of codex walking through the repro in the test (nothing happens at the start, you can skip to ~0:43):
Ok, here's an updated playwright test that codex claims repros the issue locally (it still uses Playground, but it looks like it tries to do so locally, see this and this file for more details about what's going on; it's still somewhat odd, but less so than the original playwright test).
I have replicated it in Chrome and only when making styling related changes but I can't quite nail it down. What @danluu shared above is much more accurate than anything I've been able to discern!
Should a null check on contentDocument fix this for Gutenberg? It would stop the uncaught error crash. The playground canvas may still end up blank though.
As mentioned there in that doc, null checking could be added, but it'd still lead to an empty iframe, so I don't know that it solves much. Some error handling might be a better option.
I'm now running into this what feels like more frequently. Here are some examples that I can't replicate but where and when the issue occurred:
Adding a site icon in the Identity section and saving.
Adding new pages to the navigation block and publishing them. From there, trying to view one of the pages I just created and the editor was blank.
Changing the site tagline in the Identity section, saving, then switching to "Styles" > it goes blank in the preview and I can't click into the canvas.
Activity
talldan commentedon Jul 15, 2026
I'm still trying to reproduce this. My guess is it's this line of code -
gutenberg/packages/block-editor/src/components/iframe/index.js
Line 213 in 90542b4
Something I notice is that the preview completely reloads, even when its already showing the same content, so an optimization could be to not do that 😄
talldan commentedon Jul 15, 2026
I saw the same error is mentioned in this PR - #75619, but that's somewhat old and seems related to react strict mode, which I don't think would be active in the playground.
talldan commentedon Jul 15, 2026
@annezazu I haven't been able to reproduce. Could you provide some extra information?
While we could implement some defensive coding, I think a reproduction for this bug will be important to successfully prove that a fix works.
danluu commentedon Jul 15, 2026
Codex claims it was able to get a repro. More detailed info (with step-by-step repro instructions) here.
When I tried to manually execute the repro steps, I took long enough to do them that I got the blank page and
at the
Design>Identitystep, so the repro seems unnecessarily complicated (I had codex update the repro instructions; the old instructions are still there below the updated instructions).Codex also produced a playwright test that repros the issue, but it's a bit odd in that it appears to actually connect to the playground URL instead of reproducing locally, which is what you'd want in a test. Let me see if I can get it to produce a more reasonable test. FWIW, here's a video of codex walking through the repro in the test (nothing happens at the start, you can skip to ~0:43):
issue-80262-natural-repro-annotated.mp4
danluu commentedon Jul 15, 2026
Ok, here's an updated playwright test that codex claims repros the issue locally (it still uses Playground, but it looks like it tries to do so locally, see this and this file for more details about what's going on; it's still somewhat odd, but less so than the original playwright test).
annezazu commentedon Jul 15, 2026
I have replicated it in Chrome and only when making styling related changes but I can't quite nail it down. What @danluu shared above is much more accurate than anything I've been able to discern!
Swanand01 commentedon Jul 17, 2026
Should a null check on
contentDocumentfix this for Gutenberg? It would stop the uncaught error crash. The playground canvas may still end up blank though.talldan commentedon Jul 20, 2026
The analysis shared by @danluu is pointing to it being a Playwright issue more than a Gutenberg one, so the issue should at least be raised there too - https://github.com/danluu/gutenberg/blob/agent/issue-80262-repro-explanation/test/e2e/specs/site-editor/issue-80262-repro.md#source-level-cause.
As mentioned there in that doc,
nullchecking could be added, but it'd still lead to an empty iframe, so I don't know that it solves much. Some error handling might be a better option.annezazu commentedon Jul 20, 2026
I'm now running into this what feels like more frequently. Here are some examples that I can't replicate but where and when the issue occurred:
talldan commentedon Jul 21, 2026
@annezazu As mentioned above, it's likely a playground issue. I've made an issue on the playground repo for you - WordPress/wordpress-playground#4138.
annezazu commentedon Jul 21, 2026
Cool, if it points in that direction let’s close this out so as not to distract. I’ll test locally going forward to be safe.