WordPress.org

Make WordPress Core

Opened 10 months ago

Last modified 10 months ago

#52473 closed defect (bug)

Twenty Twenty-One: Dark Mode toggle is causing JavaScript error in block editor — at Version 2

Reported by: ocean90 Owned by:
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.6
Component: Bundled Theme Keywords: has-patch commit
Focuses: javascript, administration Cc:

Description (last modified by SergeyBiryukov)

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.

Change History (3)

@mukesh27
10 months ago

#1 @mukesh27
10 months ago

  • Keywords has-patch added; needs-patch removed

52473.diff patch fix the issue.

#2 @SergeyBiryukov
10 months ago

  • Description modified (diff)
  • Milestone changed from Future Release to 5.7
Note: See TracTickets for help on using tickets.