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

fix(v2): dynamic dark mode detection without toggle widget #3877

Merged
merged 2 commits into from
Dec 4, 2020

Conversation

hmil
Copy link
Contributor

@hmil hmil commented Dec 3, 2020

Motivation

Dynamic automatic dark mode detection is disabled when the manual switch is hidden. But I want to enjoy the benefits of automatic dark-mode switching without showing the manual toggle.

See details in #3876

close #3876

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

With the following config:

    colorMode: {
      defaultMode: 'light',
      disableSwitch: true, // Don't show manual switch
      respectPrefersColorScheme: true, // But respect user preference!
    },

🎥 before this fix
🎥 after this fix

Not shown in the screencasts: Currently, the correct color theme gets applied but only if you do a hard reload of the page. The difference that this fix makes is that you don't have to reload the page anymore.

Related PRs

none

@facebook-github-bot
Copy link
Contributor

Hi @hmil!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@hmil
Copy link
Contributor Author

hmil commented Dec 3, 2020

Please re-run the CLA check.

@github-actions
Copy link

github-actions bot commented Dec 3, 2020

Size Change: 0 B

Total Size: 157 kB

ℹ️ View Unchanged
Filename Size Change
website/build/blog/2017/12/14/introducing-docusaurus/index.html 20.7 kB 0 B
website/build/docs/introduction/index.html 180 B 0 B
website/build/index.html 5.84 kB 0 B
website/build/main.********.js 113 kB 0 B
website/build/styles.********.css 17.5 kB 0 B

compressed-size-action

@netlify
Copy link

netlify bot commented Dec 3, 2020

✔️ Deploy preview for docusaurus-2 ready!

🔨 Explore the source changes: 2ffa4df

🔍 Inspect the deploy logs: https://app.netlify.com/sites/docusaurus-2/deploys/5fca28993552280007a8671f

😎 Browse the preview: https://deploy-preview-3877--docusaurus-2.netlify.app

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 4, 2020
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@slorber
Copy link
Collaborator

slorber commented Dec 4, 2020

thanks, that makes sense!

@github-actions
Copy link

github-actions bot commented Dec 4, 2020

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 91
🟢 Accessibility 99
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-3877--docusaurus-2.netlify.app/classic/

@slorber slorber merged commit c4aeb19 into facebook:master Dec 4, 2020
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic detection of dark mode not working when disableSwitch=true
3 participants