stylus icon indicating copy to clipboard operation
stylus copied to clipboard

[Bug] Opening popup triggers extension mode flip

Open Tech-How opened this issue 1 year ago • 1 comments

Bug Report

Bug Description

If you have themes installed that are set to only activate when the Stylus extension is in dark mode, and the Stylus extension is currently in light mode, opening the extension pop-up on an affected webpage will cause all dark-mode-only styles to become active. This probably works the other way around as well.

System Information

  • OS: Windows
  • Browser: Firefox 129.0.1
  • Stylus Version: 1.5.48

Additional Context

To reproduce this, do the following:

  • In Firefox Settings (about:preferences#general), set the browser theme to Automatic, and make sure the Firefox theme is set to "System theme" under (about:addons). Additionally, set the Windows app theme to dark.
  • Set the Stylus extension theme settings to "By system preference"
  • Open a style in the editor, and under "Style settings" in the left pane, select dark. This should configure that style to only activate when the system is in dark mode.
  • Visit the website the style is installed for. The style should be active.
  • Go to (about:preferences#general) in Firefox, and change the browser theme from Automatic to Light.
  • Return to the website. The style should no longer be active.
  • Open the stylus pop-up from the browser toolbar. The style activates again, even though the system is still in light mode.

Not all of these steps may be necessary, but I wanted to provide as much detail as possible.

Tech-How avatar Aug 19 '24 02:08 Tech-How

It's a bug in Firefox's implementation of this global theme option that apparently affects matchMedia API in extensions. Not sure how we can circumvent it.

tophf avatar Aug 19 '24 09:08 tophf