-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix detector hint for www.youtube.com #14617
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
base: main
Are you sure you want to change the base?
Conversation
src/config/detector-hints.config
Outdated
| MATCH | ||
| [dark] | ||
|
|
||
| IFRAME |
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.
Could you please tell if this is necessary? If it's for the studio subdomain only, maybe it's worth moving it to a separate section?
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 found that embeded live chat (www.youtube.com domain) is not detected as expected if you turn off and on Dark Reader.
Though I didn't find out why Dark Reader doesn't mis-enable without restarting, it behaves correctly if it's not an iframe. Therefore, I thought the reason is something stops the detection (I initially thought it's the mismatched domain), and then I found
darkreader/src/background/extension.ts
Lines 702 to 707 in 6c9edf3
| const detectDarkTheme = ( | |
| settings.detectDarkTheme && | |
| (isTopFrame || detectorHints?.some((h) => h.iframe)) && | |
| !isURLInList(tabURL, settings.enabledFor) && | |
| !isPDF(tabURL) | |
| ); |
If the hint doesn't allow iframes, the detector is not run on iframes:
darkreader/src/inject/index.ts
Lines 135 to 142 in 6c9edf3
| if (detectDarkTheme) { | |
| runDarkThemeDetector((hasDarkTheme) => { | |
| if (hasDarkTheme) { | |
| removeDynamicTheme(); | |
| onDarkThemeDetected(); | |
| } | |
| }, detectorHints); | |
| } |
See also: #10765
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.
Did I understand the code correctly?
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.
Dark theme is usually detected on root frames. But some websites use fullscreen iframes, that's why this IFRAME is needed. Could you please share a screenshon without a fix, so that I better understand the context?
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.


No description provided.