Closed FloEdelmann closed 3 years ago
Thanks for the bug report. I've tested it with Firefox 84 (on Linux/Fedora 33) and the initial load works, at least (and is logged in the console):
Following your exact STR's it does not work, however, indeed. The issue likely is here: https://github.com/rugk/website-dark-mode-switcher/blob/ee45d2006054a190e7815b6d120818458f18a375/src/content_scripts/applyColorSchemeJs.js#L63-L71
Maybe onchange
would yield a different result?
I have to admit I have not tested that case very specifically. So if you have a fix or so, feel free to contribute.
I just tried onchange
locally, but that's not called either.
Affected website: Open Fixture Library (https://open-fixture-library.org/). Disclosure: I'm the author of that page :wink:
Bug description
The theme is not automatically toggled when clicking the extension's button. The correct theme is applied after a page reload.
Steps to reproduce
Actual behavior
The page theme does not change immediately.
Expected behavior
The page theme should change.
System
Operating system and version: Ubuntu 20.04 Browser and version: Firefox 84.0 Add-on version: 1.2
Possible solution
The page's theme switcher code is located here: https://github.com/OpenLightingProject/open-fixture-library/blob/master/ui/components/ThemeSwitcher.vue
We use
mediaQuery.addListener
to listen for changes (and toggle an attribute on the<html>
element), but that listener is never called.