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 Initial Version

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

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 (1)

@mukesh27
10 months ago

Note: See TracTickets for help on using tickets.