[wp-trac] [WordPress Trac] #54174: Twenty Twenty-One: @media (prefers-reduced-motion) in sass/07-utilities/a11y.scss breaks some plugins

WordPress Trac noreply at wordpress.org
Thu Sep 23 22:46:52 UTC 2021


#54174: Twenty Twenty-One: @media (prefers-reduced-motion) in
sass/07-utilities/a11y.scss breaks some plugins
--------------------------------------+------------------------------------
 Reporter:  gregoiresailland          |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Bundled Theme             |     Version:  5.6
 Severity:  critical                  |  Resolution:
 Keywords:  dev-feedback needs-patch  |     Focuses:  ui, accessibility,
                                      |  css
--------------------------------------+------------------------------------

Comment (by gregoiresailland):

 I found a way to disable it with javascript:

 var styleTag = document.getElementById("twenty-twenty-one-style-css");
         var sheet = styleTag.sheet ? styleTag.sheet : styleTag.styleSheet;

         if (sheet.cssRules) { // all browsers, except IE before version 9
                 for (var i=0; i<sheet.cssRules.length; i++) {
                         if (sheet.cssRules[i].conditionText === '(prefers-
 reduced-motion)') {
                                 //console.log(sheet.cssRules[i]);
                                 sheet.deleteRule (i);
                         }
                         //else{console.log(sheet.cssRules[i])}
                 }
         }
         else{  // Internet Explorer before version 9
                 for (var i=0; i<sheet.rules.length; i++) {
                         if (sheet.rules[i].conditionText === '(prefers-
 reduced-motion)') {
                                 // console.log(sheet.cssRules[i]);
                                 sheet.removeRule (i);
                         }
                 }
         }

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


More information about the wp-trac mailing list