Skip to content

Commit

Permalink
[@mantine/core] Handle undefined value in matchMedia
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjaminsson committed Jan 14, 2025
1 parent e8f7b01 commit 2042fbd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function setColorSchemeAttribute(
const hasDarkColorScheme =
typeof window !== 'undefined' &&
'matchMedia' in window &&
window.matchMedia('(prefers-color-scheme: dark)').matches;
window.matchMedia('(prefers-color-scheme: dark)')?.matches;

const computedColorScheme =
colorScheme !== 'auto' ? colorScheme : hasDarkColorScheme ? 'dark' : 'light';
Expand Down

0 comments on commit 2042fbd

Please sign in to comment.