[wp-trac] [WordPress Trac] #54852: Twenty Twenty: Consider less aggressive motion preference styles

WordPress Trac noreply at wordpress.org
Wed Jan 19 06:13:30 UTC 2022


#54852: Twenty Twenty: Consider less aggressive motion preference styles
---------------------------+---------------------------------
 Reporter:  sabernhardt    |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Future Release
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  accessibility, css
---------------------------+---------------------------------

Comment (by parinpanjari):

 this feature is implemented as a media query, it can be accessed the same
 way we access any media query values in JS: using window.matchMedia.

 function getPrefersReducedMotion() {
   const QUERY = '(prefers-reduced-motion: no-preference)';
   const mediaQueryList = window.matchMedia(QUERY);
   const prefersReducedMotion = !mediaQueryList.matches;
   return prefersReducedMotion;
 }

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54852#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list