From e0a6418e91f7d8a14935a19412ae47cdddb0f25c Mon Sep 17 00:00:00 2001 From: David Date: Thu, 20 Jul 2023 16:14:36 -0700 Subject: [PATCH] Add prefers-reduced-motion support --- src/components/still-image/still-image.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/still-image/still-image.js b/src/components/still-image/still-image.js index 480de9fa..bed4c314 100644 --- a/src/components/still-image/still-image.js +++ b/src/components/still-image/still-image.js @@ -12,12 +12,16 @@ const StillImage = { data () { return { stopGifs: this.$store.getters.mergedConfig.stopGifs, - isAnimated: false + isAnimated: false, + prefersReducedMotion: false } }, + created () { + this.prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches + }, computed: { animated () { - return this.stopGifs && this.isAnimated + return this.stopGifs && this.isAnimated && this.prefersReducedMotion }, style () { const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str