-
Notifications
You must be signed in to change notification settings - Fork 934
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
New LV project gets "Layout was forced before the page was fully loaded" warning on Firefox #3445
Comments
Did some testing here. With any or all of these changes done, I still get that message
Yes, if I add a styled div to the live view render functions and with no other changes, rapid refreshing will show the style is "flashing in". However, even with a blank html document, the message is still there. So these two problems are possibly two conceptually related, but separate things. EDIT: To add, I see the message on the default dead view as well. |
I think the message from Firefox is just a bug in the dev tools inspector: https://bugzilla.mozilla.org/show_bug.cgi?id=1404468. I get the 'Layout was forced...' message with just html/css:
(where |
It's happening to me too, but I think it's a problem in Firefox. I can't reproduce it in Chrome. |
I noticed that every page loading a stylesheet in the traditional way triggered the "Layout was forced..." warning in the Firefox developer tools. After trying various solutions, I found that using this code effectively removed the warning: <link rel="preload" href="/user/themes/orca/css/custom.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/user/themes/orca/css/custom.css"></noscript> This workaround ensures the stylesheet loads without prompting the warning, likely due to how Firefox handles CSS loading and layout rendering. |
That does remove the warning, but the page still renders first without the styles applied for a split second unfortunately |
In my case, it only happen when devtool is open. |
Environment
Actual behavior
On Firefox, when you load a LV page, it will generate the following warning in the console:
This means that the html is being rendered before the CSS is loaded, meaning that all texts, images, svgs, etc will be rendered for a split second without any style and then the style will be applied.
This video shows that happening when I refresh the page:
This happens in all my Phoenix LV projects, but just to make sure that is nothing that I'm doing, I also tested in a brand new Phoenix project where I just added a route with a LV with this render function:
Expected behavior
This warning shouldn't be happening and the page elements shouldn't be showing without styles when the page loads.
The text was updated successfully, but these errors were encountered: