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';