From aaab9ad0829d2fff895316797826d23f294ac966 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Mon, 22 May 2017 09:07:14 +1000 Subject: [PATCH] Seperated reduce motion check --- src/js/plyr.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index df910664..2a44a13b 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1188,9 +1188,12 @@ // Remember a device can be moust + touch enabled touch: 'ontouchstart' in document.documentElement, - // Detect transitions and if user has iOS & MacOS "Reduced motion" setting off + // Detect transitions support + transitions: utils.transitionEnd !== false, + + // Reduced motion iOS & MacOS setting // https://webkit.org/blog/7551/responsive-design-for-motion/ - transitions: utils.transitionEnd !== false && (!('matchMedia' in window) || !window.matchMedia('(prefers-reduced-motion)').matches) + reducedMotion: 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches }; // Player instance @@ -3426,7 +3429,7 @@ }); // If we can do fancy animations, we'll animate the height/width - if (support.transitions) { + if (support.transitions && !support.reducedMotion) { // Set the current width as a base container.style.width = current.scrollWidth + 'px'; container.style.height = current.scrollHeight + 'px';