-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block preview doesn't work in Firefox #29436
Comments
I'm not able to reproduce this issue personally. Could it be specific to your own setup somehow? |
Nothing special in my setup. Just rebuilt everything and it's still happening for me. It's really weird though. Sometimes I can't reproduce it at all. But then I just quit Firefox, reopen it, open the editor immediately and it's happening. But if I have multiple tabs open then it's not happening at all. 🤔 What I've noticed, |
Tried it on a fresh WP install 5.6.2, using built-in Gutenberg and I can reproduce it without any problems. |
The styling of block patterns and block styles are missing from the previews in the site editor when I use either Chrome or Firefox. |
I am currently trying to fix this error. As @david-szabo97 had already correctly noted, there seems to be a problem with the calculation of the height. The whole thing is done here:
When inspecting it, I noticed that the 'contentHeight' is not being received correctly. It is in some cases 0. This comes from this line:
onLayout is triggerd on mount and every time, a child item inside the view component changes his styles. It returns then a height, width, x and y position of the changed element. The height and width are then passed to the preview windows.. https://reactnative.dev/docs/view#onlayout However.. I have a problem. When I make changes to this file (https://github.com/WordPress/gutenberg/blob/3da717b8d0ac7d7821fc6d0475695ccf3ae2829f/packages/compose/src/hooks/use-resize-observer/index.native.js), I don't get them displayed under compose/index.js. If I read correctly, the .native.js files are only used for the mobile app? Then how come we are importing the stuff here?
PS: @carolinan my Block-Style / Pattern styles are loading correctly. |
I can reproduce this issue exactly the same as the topic starter.
I can also confirm that it's not consistent. But it always pops back up after a while. Sometimes when I switch blocks the problem goes away. Then later the problem is back again. Edit: Firefox 88.0 on macOS 11.2.3.
My understanding is that every |
But what I don't understand then is that we don't import / use the react-resize-aware hook in the auto.js, but the custom useResizeObserver hook, which then returned the height. I have tried several things but unfortunately have not found a nice solution for the problem. |
Reporting that I've replicated this issue in Chrome Version 94.0.4606.81 and FF Developer Edition - macOS Big Sur 11.6. Outcome appears fairly sporadic. |
Block patterns previews are not working for me either on Firefox 96 and Chrome 97 on Ubuntu 20. |
Works for me in Firefox 103 with WP6.0 |
Thanks for confirmation, @mrwweb |
Description
Previews are failing in Firefox. I'm not sure what's causing it cause I can't reproduce it reliably. The instructions below seem to reproduce it consistently. What I noticed is I can't reproduce it at all if Inspector is open.
Step-by-step reproduction instructions
/button
Buttons
blockButtons
blockDocument
using the footer breadcrumbsExpected behaviour
Previews 😄
Actual behaviour
No previews at all
Screenshots or screen recording (optional)
Screen.Recording.2021-03-01.at.14.17.45.mov
Tried with a smaller viewport and it's reproducible as well.
Screen.Recording.2021-03-01.at.14.20.34.mov
WordPress information
You are using a development version (5.7-beta1-50176).
Device information
The text was updated successfully, but these errors were encountered: