Automattic / Automattic/jetpack
EU Cookie Widget: JS enqueued in Customizer even if widget is not added
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### Steps to reproduce the issue
1. Make sure Jetpack widgets are enabled on your site, and EU Cookie widget is not used
2. Go to `/wp-admin/customize.php?autofocus[panel]=widgets`
3. Look into JS console
4. See error: `Uncaught TypeError: Cannot read property 'classList' of null`
It seems, that we enqueuing JS files into a customizer, but relevant markup is not present: https://github.com/Automattic/jetpack/blob/master/modules/widgets/eu-cookie-law/widget.php#L1-L6
Contributor guide
Research direction
Reproduce the issue at /wp-admin/customize.php?autofocus[panel]=widgets with the EU Cookie widget disabled, then inspect modules/widgets/eu-cookie-law/widget.php at the referenced lines. Trace why the widget JavaScript is loaded without its markup and verify that the Customizer console has no classList error when the widget is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php, wordpress
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100