Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.16k stars 4.41k forks source link

Crash when updating theme #2858

Closed grassick closed 8 months ago

grassick commented 10 months ago

Prerequisites

Describe the issue

On iOS only (we have 1000s of users on various platforms), I get the following error sometimes reported:

TypeError: window.matchMedia(o.css.isDarkPreferredQuery).addEventListener is not a function. (In 'window.matchMedia(o.css.isDarkPreferredQuery).addEventListener("change",()=>this._updateTheme())', 'window.matchMedia(o.css.isDarkPreferredQuery).addEventListener' is undefined)

User-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Mobile/15E148 Safari/604.1

I am unable to reproduce it locally, I'm afraid, but it's crashing some of our users.

StackBlitz fork

I really wish I could, but I can't reproduce it on my own iPhone!

What operating system(s) are you seeing the problem on?

iOS

What browser(s) are you seeing the problem on?

Safari

What version of are you using? You can find this information from the sample StackBlitz.

6.7.13

What your browser's locale? You can find this information from the sample StackBlitz.

en-US

stackblitz[bot] commented 10 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

grassick commented 10 months ago

Apparently old version of Safari only support addListener, not addEventListener:

https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#browser_compatibility

If you are targeting newer versions only, I'll just add a warning to update to my app.

Eonasdan commented 9 months ago

Without code to attempt to reproduce this issue, I can't do much to help. I have no way of testing Safari. According to Can I Use it is supported.