`chakra-ui-color-mode` cookie not being set in Safari, causing page flash on load and issues with `useColorModeValue`
See original GitHub issueDescription
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
- Follow steps to add Chakra to an existing React project (Next is what I used)
- Build and start the app
- Refresh page from origin
- Observe page flash and check
local storage
forchakra-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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m also seeing this issue in chrome. The local storage value is not being set.
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.