-
Notifications
You must be signed in to change notification settings - Fork 324
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
Update giscus.ejs to fix giscus color on load #11047
base: main
Are you sure you want to change the base?
Conversation
@cderv I got no response from the original issue authors. Since my changes are minimal, I think they are compatible with the rest of Quarto and ready to be merged. Please let me know if there are other things I need to do. PS: I signed a contribution agreement when I contributed to Positron, I think it also works for Quarto that I don't need to sign anything else? |
Thanks for the PR. I don't love an unbounded timeout loop; if something goes wrong we'll have something waking up the process at every 50ms, and that doesn't seem like a good idea. What if we used a MutationObserver instead? We already use this in other parts of the Quarto codebase. Good docs here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver |
@cscheid Just switched to MutationObserver, is the current version better? |
Yes, I think so, thanks! Other things we need to think about:
|
As for the contributor agreement, I have signed it with Posit when I contributed to posit-dev/ark. I think it also works for Quarto? As for websites without dark themes, I have browsed some websites without a dark theme in the Quarto gallery (e.g. https://nasa-openscapes.github.io/). It seems that for these websites, there is also a I'm not sure about how to avoid future regressions, either. I'm pretty new to TypeScript/JavaScript as you probably realised. |
It does, thanks! |
@cderv, asking for a review here specifically for guidance/idea around playwright. |
I think we can indeed test this using our playwright testings. We just need to come up with an example website that has the issue, and for which this PR fixes it. Though, we also need to have a dummy giscus set up 🤔 - I'll look into this. @kv9898 I can handle adding the test and I'll probably push in your PR before merging |
Let's talk about this when you know more. As we start to become more diligent about integration tests, this kind of issue will come up more often. |
Fixes #8613.
An async while loop check is added to wait for the
quarto-light
/quarto-dark
body class to load up. The giscus element is then created in the according theme.The effect:
Before change (using #8613's example):
After change: