Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Gracefully handle environments without window.matchMedia #7147

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

lsanwick
Copy link
Contributor

I've been struggling with using Mantine within a test environment, and it seems like the dependency on window.matchMedia isn't really required in a test environment. This change simply guards against the case where window and window.matchMedia are not defined, and avoids trying to use it in that case.

I've looked at doing mocking based on the docs here, but this creates conflicts with other libraries, like framer-motion that assume if window.matchMedia exists, that they are not in a test environment.

@rtivital rtivital merged commit bad9bc5 into mantinedev:master Nov 23, 2024
1 check passed
@rtivital
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants