From eeb43615a50c8e792e21c5845d2a7b60e9c4b67a Mon Sep 17 00:00:00 2001 From: Joan Perals Tresserra Date: Tue, 11 Nov 2025 14:06:43 +0100 Subject: [PATCH] chore: Tolerate matchMedia returning null --- src/internal/hooks/use-mobile/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/hooks/use-mobile/index.ts b/src/internal/hooks/use-mobile/index.ts index b1a6ef7d05..c6291234c4 100644 --- a/src/internal/hooks/use-mobile/index.ts +++ b/src/internal/hooks/use-mobile/index.ts @@ -26,7 +26,8 @@ function getIsMobile() { * wouldn't know which one of them to use). * Instead, we use the media query here in JS too. */ - return window.matchMedia(`(max-width: ${mobileBreakpoint}px)`).matches; + /* istanbul ignore next: matchMedia is not available in jsdom. */ + return window.matchMedia(`(max-width: ${mobileBreakpoint}px)`)?.matches; } return getMatchingBreakpoint(window.innerWidth, ['xs']) !== 'xs';