[wp-trac] [WordPress Trac] #52473: Twenty Twenty-One: Dark Mode toggle is causing JavaScript error in block editor

WordPress Trac noreply at wordpress.org
Mon Feb 8 21:08:54 UTC 2021


#52473: Twenty Twenty-One: Dark Mode toggle is causing JavaScript error in block
editor
----------------------------------------+----------------------------
 Reporter:  ocean90                     |      Owner:  (none)
     Type:  defect (bug)                |     Status:  new
 Priority:  normal                      |  Milestone:  Future Release
Component:  Bundled Theme               |    Version:  5.6
 Severity:  normal                      |   Keywords:  needs-patch
  Focuses:  javascript, administration  |
----------------------------------------+----------------------------
 For some reasons the `dark-mode-toggler.js` from Twenty Twenty-One is also
 enqueued in the block editor if Dark Mode support is enabled. This is
 causing JavaScript errors if the window (not the editor itself) is
 scrolled.

 ```
 Uncaught TypeError: Cannot read property 'classList' of null
     at checkScroll (dark-mode-toggler.js?ver=1.0.0:56)
 ```

 To reproduce enable Dark Mode support in the Customizer and open the block
 editor. Now reduce the height of the window so that you're able to scroll
 the admin menu. Once you scroll you should see the JavaScript error from
 above in the console.

 The script should either check that the toggle exists or better not
 enqueued in the block editor at all.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52473>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list