diff --git a/site/source/contexts/DarkModeContext.tsx b/site/source/contexts/DarkModeContext.tsx index e6c0fc377..0b8f8a85b 100644 --- a/site/source/contexts/DarkModeContext.tsx +++ b/site/source/contexts/DarkModeContext.tsx @@ -46,9 +46,18 @@ export const DarkModeProvider: React.FC = ({ children }) => { setDarkMode(e.matches) } const matchDarkMode = window.matchMedia('(prefers-color-scheme: dark)') - matchDarkMode.addEventListener('change', onDarkModeChange) - return () => matchDarkMode.removeEventListener('change', onDarkModeChange) + // safari 13 doesn't have addEventListener + matchDarkMode.addEventListener + ? matchDarkMode.addEventListener('change', onDarkModeChange) + : matchDarkMode.addListener(onDarkModeChange) + + return () => { + // safari 13 doesn't have removeEventListener + matchDarkMode.removeEventListener + ? matchDarkMode.removeEventListener('change', onDarkModeChange) + : matchDarkMode.removeListener(onDarkModeChange) + } }) return ( diff --git a/site/source/template.html b/site/source/template.html index 0bcac3a58..fd53b90b6 100644 --- a/site/source/template.html +++ b/site/source/template.html @@ -223,7 +223,7 @@