fix: fix reduceMotion of svelte slide transition (#1237)

fixes #1236
This commit is contained in:
Nolan Lawson 2019-05-27 00:24:57 -07:00 committed by GitHub
parent 0878275ab9
commit 6efc28aac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -98,7 +98,7 @@
import { measureText } from '../../_utils/measureText'
import { POST_PRIVACY_OPTIONS } from '../../_static/statuses'
import { store } from '../../_store/store'
import { slide } from 'svelte-transitions'
import { slide } from '../../_transitions/slide'
import { postStatus, insertHandleForReply, setReplySpoiler, setReplyVisibility } from '../../_actions/compose'
import { classname } from '../../_utils/classname'
import { POLL_EXPIRY_DEFAULT } from '../../_static/polls'

View file

@ -0,0 +1,17 @@
import { slide as svelteSlide } from 'svelte-transitions'
import { store } from '../_store/store'
import noop from 'lodash-es/noop'
// same as svelte-transitions, but respecting reduceMotion
export function slide (node, ref) {
let { reduceMotion } = store.get()
if (reduceMotion) {
return {
delay: 0,
duration: 1, // setting to 0 causes some kind of built-in duration
easing: _ => _,
css: noop
}
}
return svelteSlide(node, ref)
}