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

Preview crashes the editor (intermittent) #35807

Closed
chad1008 opened this issue Oct 20, 2021 · 2 comments · Fixed by #35832
Closed

Preview crashes the editor (intermittent) #35807

chad1008 opened this issue Oct 20, 2021 · 2 comments · Fixed by #35832
Assignees
Labels
[Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@chad1008
Copy link
Contributor

Description

Under certain conditions, the preview can crash the editor when previewing mobile/tablet and then switching back to desktop.

This isn't consistent and in my tests seems to happen most often when the post content is empty, but there may be more nuance to it than that.

note: much of this issue is copied from @worldomonation's original here

Step-by-step reproduction instructions

  1. start a new post.
  2. add title.
  3. press tab to move to the body of the post.
  4. click on Preview button.
  5. click on Mobile or Tablet.
  6. click on Desktop.

Screenshots, screen recording, code snippet

137811345-40a8a34c-defd-4d32-b352-5d935ef987a4.mov
137812376-bd3f6939-adcd-40d7-a438-797e16f6242c.mov

Environment info

Reproducable on Mozilla Firefox, Microsoft Edge, and Google Chrome. I've personally tested and reproduced on Chrome 94.0.4606.81.

Tested on Gutenberg 11.7.0, but git bisect indicates it was introduced back in #33342

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@Mamaduka
Copy link
Member

I was able to reproduce the issue, and it's mostly consistent when using reproduction steps.

Details

Uncaught TypeError: Cannot read properties of null (reading 'removeEventListener')
    at packages/components/src/popover/index.js:459

if ( anchorDocument && anchorDocument !== ownerDocument ) {
anchorDocument.defaultView.removeEventListener(
'resize',
refresh
);
anchorDocument.defaultView.removeEventListener(
'scroll',
refresh,
true
);
}

Screenshot

CleanShot 2021-10-21 at 09 45 36

@Mamaduka Mamaduka added the [Package] Components /packages/components label Oct 21, 2021
@Mamaduka
Copy link
Member

I've somewhat a naive solution for this issue, but I will give it a go 😄

I am assigning this issue to myself for now.

@Mamaduka Mamaduka self-assigned this Oct 21, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants