[feat] Support prefers-reduced-motion disabling auto-play of animated images (#324) #325

Merged
floatingghost merged 3 commits from Mergan/pleroma-fe:support-prefers-reduced-motion into develop 2023-07-21 19:37:44 +00:00
Showing only changes of commit e0a6418e91 - Show all commits

View file

@ -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