Add dynamic theme fixes for *.rtp.pt websites - #15818
Conversation
| *.rtp.pt | ||
|
|
||
| INVERT | ||
| img[src$="/rtppalco-dark_2026.svg"] |
There was a problem hiding this comment.
Top left logo at:
https://www.rtp.pt/play/palco/p16872/liniker-jazz-a-vienne
|
|
||
| INVERT | ||
| img[src$="/rtppalco-dark_2026.svg"] | ||
| .navbar-toggler-icon |
There was a problem hiding this comment.
Hamburguer icon on the top right:
https://www.rtp.pt/play/
| INVERT | ||
| img[src$="/rtppalco-dark_2026.svg"] | ||
| .navbar-toggler-icon | ||
| .uninav-menu-toggle-line |
There was a problem hiding this comment.
Lines from 1078 to 1080 are the hamburguer icon in the mobile version of:
https://www.rtp.pt/
| .uninav-menu-toggle-line | ||
| .uninav-menu-toggle::before | ||
| .uninav-menu-toggle::after | ||
| .uninav-search.is-open .uninav-search-toggle::before |
There was a problem hiding this comment.
Lines 1081 and 1082 are the close icon that is visible after clicking the search button at:
https://www.rtp.pt/
| .uninav-menu-toggle::after | ||
| .uninav-search.is-open .uninav-search-toggle::before | ||
| .uninav-search.is-open .uninav-search-toggle::after | ||
| .epg-channel-inner-header::before |
There was a problem hiding this comment.
Lines 1083 and 1084 are the plus and minus icons in the mobile version:
https://www.rtp.pt/tv/
| .uninav-search.is-open .uninav-search-toggle::after | ||
| .epg-channel-inner-header::before | ||
| .epg-channel-inner-header::after | ||
| .navbar-container .navbar-brand:has(> .ensina-logo) |
There was a problem hiding this comment.
Top left logo at:
https://ensina.rtp.pt/
| .epg-channel-inner-header::before | ||
| .epg-channel-inner-header::after | ||
| .navbar-container .navbar-brand:has(> .ensina-logo) | ||
| .footer-menu .left-section:has(> a[href="https://ensina.rtp.pt/"]) |
There was a problem hiding this comment.
Bottom left logo at:
https://ensina.rtp.pt/
| .epg-channel-inner-header::after | ||
| .navbar-container .navbar-brand:has(> .ensina-logo) | ||
| .footer-menu .left-section:has(> a[href="https://ensina.rtp.pt/"]) | ||
| .worldnav-menu-toggle-line |
There was a problem hiding this comment.
Lines from 1087 to 1089 are the Plus and X icons in the mobile version of:
https://ensina.rtp.pt/
| body | ||
|
|
||
| MATCH | ||
| .bg-black |
There was a problem hiding this comment.
Native dark theme was only found at the following urls:
https://www.rtp.pt/noticias/videos
https://www.rtp.pt/noticias/audios
There was a problem hiding this comment.
When I use .didomi-popup-open and when I use :not(.didomi-popup-open) a dark theme is detected in both cases. So perhaps there is an issue with Dark Reader on how it handles the :not() differently. In fact .didomi-popup-open is not available immediately, it becomes available one or two seconds later.
There was a problem hiding this comment.
After more testing I identified the cause. When I use :not(.didomi-popup-open) the class is not available immediately when the page is refreshed or opens for the first time, so dark reader detects a dark theme, and stops looking for class changes. The class .didomi-popup-open becomes available some miliseconds later, but because dark reader is no longer checking if the class is available or not, it does not work as we want. Changes in dark reader itself would be required, but I lack the knowledge to fix it any time soon.
There was a problem hiding this comment.
In /src/inject/detector.ts it is doing exactly as observed:
function checkMatch(target: Element) {
if (target.matches?.(matchSelector)) {
stopDetectingUsingHint();
success();
return true;
}
return false;
}
function stopDetectingUsingHint() {
hintTargetObserver?.disconnect();
hintMatchObserver?.disconnect();
}
As soon as the MATCH is found it stops looking.
There was a problem hiding this comment.
I found that too... not sure if making detection somehow delayed would be good. I am not that good in the code Alexander was writing but any changes here can crerate new issues for NO DARK THEME and SYSTEM THEME tags. (Maybe not but I prefer to have worst options in mind).
My proposal will be added (again) in PR comments.
Myshor
left a comment
There was a problem hiding this comment.
CSS changes checked and approved.
I can merge this if there won't be any dark-sites.config and detector-hints.config changes included in PR.
| kwejk.pl | ||
| kyleggiero.me | ||
| kyun.host | ||
| lab.rtp.pt |
| mstdn.social | ||
| mtv.com | ||
| musedash.moe | ||
| museu.rtp.pt |
| body | ||
|
|
||
| MATCH | ||
| .theme--night |
There was a problem hiding this comment.
Theme can be broken because of the same popup with white background...
Will need MATCH change to
MATCH
.theme--night:not(.didomi-popup-open)
After refresh it opens white didomi popup with light background.
Seems all of this sites can not be added here too.
There was a problem hiding this comment.
The problem is that .didomi-popup-open is not available when you refresh or open the page, it becomes available later. I think that is the reason why it is not working as desired.
| body | ||
|
|
||
| MATCH | ||
| .bg-black |
My proposal is still open. Remove all detector and dark-sites changes from this PR so CSS fixes can be merged. 😉Additional conclusions: The detector will not work properly when the didomi-popup opens up, because that popup loads dynamically and is added after detector-hint is checked. Even if we added a delay for that didomi-popup scenario, it could create more issues related to that delay. You can create a Feature Request for a delay while the detector check is done and tag alexanderby in it. See my worst scenario: Then we close that popup. And Dark Theme is still not detected. Because detection is not checking anything anymore. Same as detecting dark theme after changing it manually with the switch on the page—it won't work until the page is refreshed and dark theme is already selected. Summarizing: IMHO we should have these rtp.pt pages excluded from dark-sites and detector-hints totally. |



https://arquivos.rtp.pt
https://conta.rtp.pt
https://ensina.rtp.pt
https://marcas.rtp.pt
https://media.rtp.pt
https://publicidade.rtp.pt
https://rtp.pt