Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix disqus background in dark mode. (#732)
### Prerequisites - [x] This pull request fixes a bug. - [x] This pull request adds a feature. - [ ] This pull request introduces breaking change. ### Description This PR fixes the bug about disqus iframe background in dark mode, it also fix another bug when switching color mode. Before: <img width="881" alt="opaque background in dark mode" src="https://user-images.githubusercontent.com/17041194/202862887-720dbb82-f0c8-4a24-97fd-78baef2a7cb4.png"> After: <img width="883" alt="CleanShot 2022-11-20 at 01 12 52@2x" src="https://user-images.githubusercontent.com/17041194/202863146-d5a246a7-bbe5-4bef-9687-883ce33f5b1a.png"> #### Why this happens The problem is widely discussed [here](w3c/csswg-drafts#4772). >If the color scheme of an iframe differs from embedding document, iframe gets an opaque canvas bg appropriate to its color scheme. So I made two fixes: 1. Add `color-scheme: light` CSS property for disqus `iframe`, this creates a transparent background and fixes the opaque issue. 2. Add `themeChanged` event to notice disqus comments board refresh when the theme change, this fixes the opaque problem when you switch the mode. #### Reference I've been working on this issue for a whole night and the fixing idea was strongly inspired by [Sergeyski's Blog](https://sergeyski.com/css-color-scheme-and-iframes-lessons-learned-from-disqus-background-bug/). ### Issues Resolved Fixes #722.
- Loading branch information