Skip to content

NextJS 12.3.x doesn't remove FOUC style (body hidden) #41476

Closed
@OnkelTem

Description

@OnkelTem

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 12.3.2-canary.29
      eslint-config-next: 12.3.1
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

NextJS in dev mode adds this markup to the html head:

<style data-next-hide-fouc="true">body{display:none}</style>
<noscript data-next-hide-fouc="true">
  <style>body{display:block}</style>
</noscript>

As a result the page is not displayed.

Expected Behavior

It should remove this FOUC protection, or what is its name.

Link to reproduction

https://github.com/OnkelTem/demo-styled-jsx

To Reproduce

To reproduce with the referenced repository:

$ npm run dev

OR to reproduce from scratch:

$ npx create-next-app@latest --ts demo-styled-jsx
$ cd demo-styled-jsx
$ npm run dev

THEN open the page in your browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebpackRelated to Webpack with Next.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions