Skip to content

Commit 7d11a39

Browse files
committed
fix: always check for window.matchMedia support
closes #22059
1 parent d0ebeec commit 7d11a39

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/vuetify/src/components/VSwitch/VSwitch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useProxiedModel } from '@/composables/proxiedModel'
1717

1818
// Utilities
1919
import { ref, toRef, useId } from 'vue'
20-
import { filterInputAttrs, genericComponent, IN_BROWSER, propsFactory, useRender } from '@/util'
20+
import { filterInputAttrs, genericComponent, propsFactory, SUPPORTS_MATCH_MEDIA, useRender } from '@/util'
2121

2222
// Types
2323
import type { ComputedRef, Ref } from 'vue'
@@ -81,7 +81,7 @@ export const VSwitch = genericComponent<new <T>(
8181
const { isFocused, focus, blur } = useFocus(props)
8282
const control = ref<VSelectionControl>()
8383
const inputRef = ref<VInput>()
84-
const isForcedColorsModeActive = IN_BROWSER && window.matchMedia('(forced-colors: active)').matches
84+
const isForcedColorsModeActive = SUPPORTS_MATCH_MEDIA && window.matchMedia('(forced-colors: active)').matches
8585

8686
const loaderColor = toRef(() => {
8787
return typeof props.loading === 'string' && props.loading !== ''

packages/vuetify/src/composables/goto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Utilities
22
import { inject, toRef } from 'vue'
33
import { useRtl } from './locale'
4-
import { clamp, consoleWarn, easingPatterns, mergeDeep, refElement } from '@/util'
4+
import { clamp, consoleWarn, easingPatterns, mergeDeep, PREFERS_REDUCED_MOTION, refElement } from '@/util'
55

66
// Types
77
import type { ComponentPublicInstance, InjectionKey, Ref } from 'vue'
@@ -81,7 +81,7 @@ export async function scrollTo (
8181
const container = options.container === 'parent' && target instanceof HTMLElement
8282
? target.parentElement!
8383
: getContainer(options.container)
84-
const ease = window.matchMedia('(prefers-reduced-motion: reduce)').matches ? options.patterns.instant
84+
const ease = PREFERS_REDUCED_MOTION() ? options.patterns.instant
8585
: typeof options.easing === 'function' ? options.easing
8686
: options.patterns[options.easing]
8787

0 commit comments

Comments
 (0)