Quasar: Dark Mode: Toggle OS dark mode Electron

Created on 28 Nov 2019  Â·  1Comment  Â·  Source: quasarframework/quasar

Describe the bug
When toggling dark/light mode on macOS via System Preferences, the Electron render process report an error in Dark.js

Codepen/jsFiddle/Codesandbox (required)
As this is an Electron issue, I found it difficult to simulate in an online sandbox.
Quasar info:

Operating System - Darwin(18.7.0) - darwin/x64
NodeJs - 12.6.0

Global packages
  NPM - 6.9.0
  yarn - 1.19.1
  @quasar/cli - 1.0.0
  cordova - Not installed

Important local packages
  quasar - 1.5.1 
  @quasar/app - 1.3.1 -- 
  @quasar/extras - 1.3.3 -- 
  vue - 2.6.10 -- 
  vue-router - 3.1.3 -- 
  vuex - 3.1.2 -- 
  electron - 7.1.2 -- 
  electron-packager - 14.1.0 -- 
  electron-builder - 21.2.0 -- 
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed
  @babel/core - 7.7.0 -- Babel compiler core.
  webpack - 4.41.2 -- 
  webpack-dev-server - 3.9.0 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - 4.3.1 -- 

Quasar App Extensions
  @quasar/quasar-app-extension-qscroller - 1.0.3 -- 
  @quasar/quasar-app-extension-icon-genie - 1.1.2 -- Icons

To Reproduce
Steps to reproduce the behavior:

  1. Go to System Preferences on macOS (>=10.14.x)
  2. Click on General
  3. Select either Dark or Light themes
  4. Error thrown in Electron Dev Tools Console
Dark.js?ff52:89 Uncaught TypeError: Cannot read property 'matches' of undefined
    at MediaQueryList.__updateMedia (Dark.js?ff52:89)
__updateMedia @ Dark.js?ff52:89

Expected behavior
Expect Quasar to detect mode.

// quasar.conf.js
framework: {
//…
  config: {
    dark: 'auto'
  }
// 

Screenshots
Error below throws when the os dark or light mode is selected. Quasar updates after restart.
Error

Platform (please complete the following information):
OS: macOS >=10.14
Node: 12.6.0
NPM: 6.9.0
Yarn: 1.19.1
Browsers: Electron Chromium 78.0.3904.113
iOS: N/A
Android: NA
Electron: 7.1.2

Additional context
Add any other context about the problem here.

bug

Most helpful comment

Hi,

Thanks for reporting!
Fix will be available in "quasar" v1.5.2.

>All comments

Hi,

Thanks for reporting!
Fix will be available in "quasar" v1.5.2.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hctpbl picture hctpbl  Â·  3Comments

danikane picture danikane  Â·  3Comments

slowaways picture slowaways  Â·  3Comments

jean-moldovan picture jean-moldovan  Â·  3Comments

jippy89 picture jippy89  Â·  3Comments