-
Notifications
You must be signed in to change notification settings - Fork 18k
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
x/pkgsite: dark theme preference not persisting #47423
Comments
Debugging notesI tried three kinds of requests with % curl -sN 'https://pkg.go.dev/net/http' | head # no cookie
% curl -sN --cookie 'prefers-color-scheme=light' 'https://pkg.go.dev/net/http' | head # explicit light-theme cookie
% curl -sN --cookie 'prefers-color-scheme=dark' 'https://pkg.go.dev/net/http' | head # explicit dark-theme cookie For all three requests, the response HTML looked like the following. But I would have expected it to have
https://pkg.go.dev/license-policy: Next, I tried the same with the % curl -sN 'https://pkg.go.dev/license-policy' | head
% curl -sN --cookie 'prefers-color-scheme=light' 'https://pkg.go.dev/license-policy' | head
% curl -sN --cookie 'prefers-color-scheme=dark' 'https://pkg.go.dev/license-policy' | head The first two responses, as expected:
The last one, as expected:
|
Change https://golang.org/cl/337769 mentions this issue: |
Thank you for the detailed issue! The keyboard shortcut wasn't documented yet because it was mainly intended for debugging purposes. The caching strategy we use for the documentation page complicates setting a persistent theme choice that is rendered on the server. We'll need to rely on the visitors system-wide prefers-color-scheme setting while we implement a workaround. |
…s pageviews" This reverts commit f9028c5. Reason for revert: Toggled color scheme persists in the cache for all users of pkg.go.dev. For golang/go#47423 Fixes golang/go#47421 Change-Id: Ib3294d5ee0c7055f884661f1d4225e130e38d548 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/337769 Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Jamal Carvalho <jamal@golang.org>
Change https://golang.org/cl/337870 mentions this issue: |
What is the URL of the page with the issue?
e.g. https://pkg.go.dev/net/http
But not https://pkg.go.dev/license-policy.
What is your user agent?
Google Chrome:
Screenshot
Not useful.
What did you do?
The issue is possibly related to cookies, hence the use of incognito browser window for reliable reproducibility.
To preface, my system uses a light theme.
In a new incognito window:
t
(keyboard shortcut, albeit undocumented, to toggle light/dark mode).document.cookie
; it containsprefers-color-scheme=dark
, as expected.What did you expect to see?
The page to render in dark mode.
What did you see instead?
The page rendered in light mode.
It appears that the cookie
prefers-color-scheme
isn't being respected.If I repeat the above steps for the URL https://pkg.go.dev/license-policy in a separate incognito window, the dark theme preference is respected. So it appears to also be something to do with package pages (e.g.
net/http
) vs. "static" pages (license-policy
).The text was updated successfully, but these errors were encountered: