Problem/Motivation
Adding as bug based on https://www.drupal.org/project/eu_cookie_compliance/issues/3109907
When using categories and using "save preferences"/"accept all cookies" option instead of the standard "accept" selecting zero categories does not count as not consenting.
Steps to reproduce
Use cookie categories
Select 'Replace the Agree button with "Save preferences" and "Accept all categories" buttons.' option
Make sure "fix first", etc isn't checked
Click "save preferences" on the popup with no categories selected.
The state is stored as 2.
Proposed resolution
When saving preferences with no categories selected, treat it the same as withdrawing consent.
User interface changes
Clicking "save preferences" will trigger the withdrawAction, thus refresh the page and show the popup again.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | D7.3168910.save-preferences-no-categories.6.patch | 1.57 KB | grayle |
| #7 | D8.3168910.save-preferences-no-categories.6.patch | 1.57 KB | grayle |
Comments
Comment #2
grayle commentedD8 patch
Comment #3
grayle commentedD7 patch
Comment #4
svenryen commentedAwesome, thanks! Will have a look today or tomorrow.
Comment #5
grayle commentedAssuming this (and the original patch's) approach is correct. It basically forces people to pick a category, but declining all categories (assuming they're all optional, which is itself probably an edge case, you'll usually always have a "functional" category as required) is, I think, a valid option.
Currently, when not using categories, you can decline cookies and the status gets set to '0' (correct me if I'm wrong here).
When using categories, if you select no categories, the status gets set to 'null', meaning the popup will show up again and again until they accept a category. I think it should probably simply set the status to '0' as well, to match the standard decline option.
Comment #6
svenryen commentedOK. Is that reflected in your patch or do you need to update it? The use of `null` and `0` sure is a bit confusing, we should do better in 2.x :)
Comment #7
grayle commentedNew patches, will set status to 0 when declining cookies by way of not selecting any categories.
Talked to legal, and you don't have to add your functional cookies as a required category, or at all, so the case where all categories are optional and functional cookies are implied is real.
And this approach works for all cases, anyway. I believe it's incorrect to set the state to null when not agreeing to any categories. 0 seems correct.
Has no impact on existing sites, except to make it better. Users who keep refusing cookies on each page load now will only have to do so once more after this gets in.
Comment #9
svenryen commentedI have a few questions. Have you tested this without categories (consent by default)? And will it not break existing functionality for the banner with no categories when you remove
euCookieComplianceLoadScripts()on line 402?Comment #10
grayle commentedI believe the random euCookieComplianceLoadScripts() was a bug/random copy paste error. Seeing as the loadCategoryScripts method uses that function as well to load scripts for the selected categories I don't see the point in calling it before then with no parameters at all.
I haven't tested it with non-category consent, however savePreferences only gets attached when you're using cookie categories (where I removed the euCookieComplianceLoadScripts()) and the change in the other method should already be wrapped in a check so it only runs when the banner is using categories.
But it can't hurt to doublecheck.
Comment #11
svenryen commentedThanks for clarifying that. I'll merge this tonight then.
Comment #12
svenryen commented-
Comment #13
svenryen commented-
Comment #14
svenryen commentedWorks great!
Comment #17
svenryen commented