RESOLVED FIXED 169835
MediaQueryList instances do not update for `prefers-reduced-motion`
https://bugs.webkit.org/show_bug.cgi?id=169835
Summary MediaQueryList instances do not update for `prefers-reduced-motion`
Dean Jackson
Reported 2017-03-17 15:58:36 PDT
From Rob Brackett This is in Safari Tech Preview 22 on OS X 10.12.3. The reduced motion query does not appear to work in the current WebKit nightly (is that also a bug?) Summary: MediaQueryList instances (created with `window.matchMedia(query)`) for the CSS `prefers-reduced-motion` query do not update their `matches` property or dispatch event listeners when the underlying system status changes. New instances do get the correct current value. Steps To Reproduce: 1. Ensure “reduce motion” is off in OS X accessibility settings 2. Create a query, check its status, and add a listener with the following JS: var prefersReducedMotion = matchMedia(`(prefers-reduced-motion)`); prefersReducedMotion.matches; // false prefersReducedMotion.addListener(function () { var currentValue = prefersReducedMotion.matches; console.log(`Motion changed: ${currentValue ? `reduced` : `normal`}`); }); 3. Change motion preferences in the OS X accessibility settings panel Expected Result: The message “Motion changed: reduced” should have been logged to the console. Checking the JS `prefersReducedMotion.matches` should be `true`. Results: Nothing is logged. Checking `prefersReducedMotion.matches` is `false`. However, creating a new query yields `true`: matchMedia(`(prefers-reduced-motion)`).matches; // true
Attachments
Patch (4.74 KB, patch)
2017-03-17 16:02 PDT, Dean Jackson
andersca: review+
Dean Jackson
Comment 1 2017-03-17 15:58:59 PDT
Dean Jackson
Comment 2 2017-03-17 16:02:27 PDT
Dean Jackson
Comment 3 2017-03-17 16:41:56 PDT
Note You need to log in before you can comment on or make changes to this bug.