Skip to content

Site Editor canvas preview goes blank after saving post style changes #80262

Closed

Description

@annezazu

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 are two different examples of it:

canvas.going.blank.after.style.changes.and.saves.mov
canvas.breaking.mov

Here's an example of what I see in the console in case it helps:

Image

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.

@danluu this might be a good issue to do some fuzzing with? @tellthemachines / @talldan as a heads up.

Activity

  1. added
    [Type] Bug
    Global Styles
    on Jul 14, 2026
  2. self-assigned this
    on Jul 15, 2026
  3. moved this from ❓ Triage to 📥 Todo in WordPress 7.1 Editor Taskson Jul 15, 2026
  4. talldan commented on Jul 15, 2026

    @talldan
    Contributor

    I'm still trying to reproduce this. My guess is it's this line of code -

    const { documentElement } = contentDocument;

    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 😄

  5. talldan commented on Jul 15, 2026

    @talldan
    Contributor

    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.

  6. talldan commented on Jul 15, 2026

    @talldan
    Contributor

    @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.

  7. danluu commented on Jul 15, 2026

    @danluu
    Contributor

    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

    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):

    issue-80262-natural-repro-annotated.mp4
  8. danluu commented on Jul 15, 2026

    @danluu
    Contributor

    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).

  9. annezazu commented on Jul 15, 2026

    @annezazu
    ContributorAuthor

    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!

  10. added
    [Feature] Site Editor
    and removed
    Global Styles
    on Jul 16, 2026
  11. Swanand01 commented on Jul 17, 2026

    @Swanand01
    Contributor

    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.

  12. talldan commented on Jul 20, 2026

    @talldan
    Contributor

    Should a null check on contentDocument fix this for Gutenberg? It would stop the uncaught error crash.

    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, 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.

  13. removed their assignment
    on Jul 20, 2026
  14. annezazu commented on Jul 20, 2026

    @annezazu
    ContributorAuthor

    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.
  15. talldan commented on Jul 21, 2026

    @talldan
    Contributor

    @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.

  16. annezazu commented on Jul 21, 2026

    @annezazu
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Site Editor[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions