-
Notifications
You must be signed in to change notification settings - Fork 224
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 dark mode slider #240
base: master
Are you sure you want to change the base?
Fix dark mode slider #240
Conversation
This solves the problem but is a bit slow. |
How about using the method used for https://learn.circuitverse.org/ |
Probably can use that as well. @animesh-007 would you work on this one ? I'll tell you what the problem is :- We run a function in the window.onLoad part of the script. That's where the problem lies. There's a chunk of code that assigns a ref in case darkmode is already enabled in localStorage. So, sometimes, that chunk of code gives an error, that causes the slider to move back. I'll also tag the exact line of code that does this. If you can bypass it, then it'll work. |
show = !show; | ||
document.querySelector("input[type='checkbox']").checked = true; | ||
console.log(document.querySelector("input[type='checkbox']")) | ||
document.querySelector("input[type='checkbox']").checked = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I placed this console.log deliberately here. If you open up your console, switch to dark mode and refresh, sometimes you'll see the proper input, and sometimes you'll see null. This null is the source cause of error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I placed this console.log deliberately here. If you open up your console, switch to dark mode and refresh, sometimes you'll see the proper input, and sometimes you'll see null. This null is the source cause of error.
@animesh-007 , here.
Ok I will try to solve it just tag me exact lines. |
@ShubhankarKG @animesh-007 are you working on this? |
I mean, this current version is just a tad slow. This works perfectly well after a time interval. |
Fixes #221
Changes done:
✅️ By submitting this PR, I have verified the following