question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`chakra-ui-color-mode` cookie not being set in Safari, causing page flash on load and issues with `useColorModeValue`

See original GitHub issue

Description

chakra-ui-color-mode not being set in Safari, causing page flash on load

Link to Reproduction

https://codesandbox.io/s/jolly-ramanujan-uz3t95?file=/src/index.tsx

Steps to reproduce

  1. Follow steps to add Chakra to an existing React project (Next is what I used)
  2. Build and start the app
  3. Refresh page from origin
  4. Observe page flash and check local storage for chakra-ui-color-mode cookie, which will not be set

Chakra UI Version

1.8.5

Browser

Safari Version 15.2 (17612.3.6.1.6)

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

The cookie is properly set in Chrome, so this issue only takes place in Safari.

The issue also impacts the proper color rendering for components at the page level vs within a component file; the former will use the wrong color value unless the cookie is set.

I tried reproducing making a fully reproducible one in codesandbox, but it looks like the next one is fragile and breaks once you create a single error; after 6 attempts, I gave up and just made one locally. Here’s the repo and below is a screenshot of the example I created within it.

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
kaityhallmancommented, Mar 9, 2022

I’m also seeing this issue in chrome. The local storage value is not being set.

1reaction
akroll1commented, Jun 1, 2022

I also had this issue and it bothered me, and I don’t think this is a safari issue. In my debugging I couldn’t get the initialColorMode prop to work in the ColorModeScript, which was pretty confusing for awhile. I put a config in a custom theme I created and it is respecting that.

I think another thing to watch out for that the script seems to get cached there, I would clear out the local storage flag for this and open a new tab… Maybe not, I forget all the steps I took lol but I know the initialColorMode prop is not working in ^2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clear cookies in Safari on Mac - Apple Support
Clear cookies in Safari on Mac. You can see all the websites that have stored cookies and website data on your Mac, and...
Read more >
Enable Cookies in Safari on macOS - WhatIsMyBrowser.com
Most websites need cookies enabled to work properly, so check out our guide to configuring cookies and permissions on Safari on macOS.
Read more >
Remove cookies from Safari browser on Mac
A cookie is a piece of data left on your browser after you visit a website. Websites can scan your cookies to see...
Read more >
10 Ways to Fix Netflix Flickering on Safari - Software Tested
Users have noticed that the screen is flickering when watching Netflix on Safari, especially when the subtitles are enabled. This problem doesn't happen...
Read more >
Cookie issues on Safari | OneSpan Community Platform
The problem seems to be in setting/creating a cookie. If we visit the ESignLive login page directly, a cookie for the esignLive domain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found