Fix: iOS 12.2 incompatible script (#19029)

This commit is contained in:
Michael Geers 2025-02-21 14:45:32 +01:00 • committed by GitHub
parent 8e521ca653
commit 9869149cf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -65,7 +65,9 @@ function updateCssColors() {
// update colors on theme change
const darkModeMatcher = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
darkModeMatcher?.addEventListener("change", updateCssColors);
if (darkModeMatcher && darkModeMatcher.addEventListener) {
darkModeMatcher.addEventListener("change", updateCssColors);
}
// initialize colors
updateCssColors();
window.requestAnimationFrame(updateCssColors);

View file

@ -62,7 +62,9 @@ function updateMetaThemeForBackdrop() {
}
export function watchThemeChanges() {
darkModeMatcher?.addEventListener("change", updateTheme);
if (darkModeMatcher && darkModeMatcher.addEventListener) {
darkModeMatcher.addEventListener("change", updateTheme);
}
updateTheme();
// listen for modal backdrops