Automattic / Automattic/jetpack

EU Cookie Law banner widget breaks when more than one has been added

Open
#10,878 9 comments 0 reactions 0 assignees View on GitHub
[Feature] Extra Sidebar Widgets [Pri] Low [Status] Stale Bug Customer Report [LEGACY]
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### Steps to reproduce the issue

1. Open *Appearance* -> *Widgets* in wp-admin.
2. Add more than one EU Cookie Law widget, preferably in a random order.
3. Open the site and click the *Close and accept* button.

#### What I expected

The widget should fade out and the `eucookielaw` cookie should be set.

#### What happened instead

The form is submitted via a post method, instead of a `event.preventDefault` happening.

#### Suggestions

Perhaps `eu-cookie-law.js` could be mended around this, by handling an array of EU Cookie Law widgets.

Furthermore, the widget uses an `id` attribute that's not unique. Depending on a CSS class would be a better way to handle multiple copies of the same widget.

Contributor guide

Open the contributing guide

Research direction

Start with eu-cookie-law.js and reproduce the issue by adding multiple EU Cookie Law widgets in Appearance → Widgets, preferably in random order. Trace how the close-and-accept action selects widgets and handles submission; done means each widget fades out without a POST and the eucookielaw cookie is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.