Skip to content

Commit

Permalink
Remove dynamic theme when darkreader-lock is detected early (#9914)
Browse files Browse the repository at this point in the history
- Currently if `document.head` is already available to Dark Reader(and thus doesn't need to run a mutationobserver), it wouldn't remove the `darkreader-fallback` element when a `<meta name="darkreader-lock">` was found.
- Resolves #9802 (reply in thread)
  • Loading branch information
Gusted committed Sep 24, 2022
1 parent 9241daa commit 830468c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## Unreleased

- Fixes a issue where `darkreader-fallback` wasn't removed from the DOM, when Dark Reader finds a `<meta name="darkreader-lock">` element.

## 4.9.58 (Sep 22, 2022)

- Remove newlines from CSS URL values, before handling them.
Expand Down
1 change: 1 addition & 0 deletions src/inject/dynamic-theme/index.ts
Expand Up @@ -488,6 +488,7 @@ export function createOrUpdateDynamicTheme(filterConfig: FilterConfig, dynamicTh
isIFrame = iframe;
if (document.head) {
if (isAnotherDarkReaderInstanceActive()) {
removeDynamicTheme();
return;
}
document.documentElement.setAttribute('data-darkreader-mode', 'dynamic');
Expand Down

0 comments on commit 830468c

Please sign in to comment.