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

Next 13: dark attribute not getting added on global error pages #174

Open
dimitraz opened this issue Apr 10, 2023 · 1 comment
Open

Next 13: dark attribute not getting added on global error pages #174

dimitraz opened this issue Apr 10, 2023 · 1 comment

Comments

@dimitraz
Copy link

For some context:
We've got this playing really well with app directory and can seamlessly switch between dark and light mode when needed.
One issue I am seeing however is with global error pages - they always render in light mode. For example, when throwing a notFound, the dark mode attributes are not getting added to the <html> tag at all. Wondering if anyone has run into this problem and have an idea on how to resolve it?

App.tsx
We want to disable light mode entirely for the moment

<ThemeProvider
  attribute="class"
  forcedTheme="dark"
  defaultTheme="dark"
  enableSystem={false}
>
 {children}
</ThemeProvider>

tailwind.config.js:
Using class setting

module.exports = {
  darkMode: 'class', 
  ... 
}

Nextjs version: 13.2.5-canary.19

@lundjrl
Copy link

lundjrl commented May 25, 2023

@dimitraz Not sure if this is still an issue for you but I used this fork and dark mode works for the app dir in Next.js 13.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants