orestbida / cookieconsent

:cookie: Simple cross-browser cookie-consent plugin written in vanilla js
https://playground.cookieconsent.orestbida.com/
MIT License
4k stars 410 forks source link

Add third button #79

Closed SoftCreatR closed 2 years ago

SoftCreatR commented 3 years ago

It would be great if there would be an optional, third button so that one can provide the options

Accept all / Accept necessary Decline / Accept necessary Settings / Accept necessary

like most other consent tools provide. At least in Germany, it is necessary to have an accept button and a decline button with equal weight, if the accept button enables all options.

So I'm thinking about something like that:

image

orestbida commented 3 years ago

Hi @SoftCreatR,

the reason why there's not a 3rd optional button is because adding one would “ruin” the layout of those modals with very little text. Modals with the box layout would become quite ugly; I'd have to either make all the 3 buttons super small or re-arrange them vertically.

With that being said, you can still add your own elements, by either injecting your own links/buttons or simply by putting them inside the description field:

dsdsdsd

As for the equal weight argument, I think it should be possible by modifying the css variables' values inside the .css file. I don't think it's worth adding an ad-hoc option in the javascript configuration as it is something quite specific/niche.

With that being said, I'd like to leave this issue open to hear more opinions!

MLzen commented 3 years ago

Hi Orestbida,

first of all: Very big thank you for this great cookieconsent tool. I used klaro! before but klaro! is really not that aesthetic and it seems they stopped developing it. Now back to topic :)

@SoftCreatR Why add a third button with "Settings" when you have a "Manage preferences" link (I guess this can be renamed into "Individual settings")? This one would rarely be used by anyone. There are other problems with the actual dialog. The "force consent" option in your cookieconsent would not be allowed in Germany when you cannot get to the Impressum (Imprint) directly.

This is the consent dialog of borlabs: grafik IMO it is one of the cleanest dialogues that takes all legal aspects into account. Maybe you can orientate the consent more to this arrangement plus adding a option for y-centering on desktops.

SoftCreatR commented 3 years ago

I already switched to the textual settings link.

Iris92 commented 3 years ago

Hi I'm agree with @SoftCreatR. A third button with "Decline" would be appreciated ;)) @orestbida : By the way you have made the best design for cookies consent ;)) Hats off !

dramocz commented 2 years ago

Hi, thanks for the great script! I would also welcome the possibility of displaying a third button for quick rejection of cookies. In the Czech Republic, the legislation requires the same level of acceptance and rejection of cookies in the first step.

jelen07 commented 2 years ago

@dramocz You're able to achieve that with two buttons - first is accept_all, the second is accept_necessary and the settings trigger could be in the text.

That will be a completely legal setup. What do you think?

dramocz commented 2 years ago

@jelen07 Thanks for the tip. I've inserted the link in the text, I think that's a sufficient solution.

lmc-product commented 2 years ago

Hi, thanks for the great script! I would also welcome the possibility of displaying a third button for quick rejection of cookies. In the Czech Republic, the legislation requires the same level of acceptance and rejection of cookies in the first step.

Really? I am from CZ as well and there is no such requirement in law as far I know.

See also European Data Protection Board available how to handle consents: https://edpb.europa.eu/sites/default/files/files/file1/edpb_guidelines_202005_consent_en.pdf or https://edpb.europa.eu/sites/default/files/files/file1/edpb_guidelines_202005_consent_cs.pdf

So basically you should be able to give consent or not give consent in "equal prominence" display. Which I think Accept only necesssary cookies is good enough.

SoftCreatR commented 2 years ago

Using it like this is absolutely fine with GDPR:

Screenshot_20211129-131927_Edge

However, requirements may change (at least in Germany) on Dec 1st.

paolonet commented 2 years ago

hi, i had the same problem and this is my solution:

after cookieconsent.run() i simply append a new button to “c-bns” div. Here with jquery:

cookieconsent.run(“stuff to do”); $('#c-bns').append('<button type="button" data-cc="c-settings" class="c-bn c_link" aria-haspopup="dialog">Settings</button>');

not so elegant, but it's a good workaround

@orestbida Great work!

Rombecchi commented 2 years ago

Here in Italy, our GDPR requires us to put an "X" in the top right corner of the banner to refuse all cookies except the necessary ones. I am asking if it would be possible to add this possibility. https://www.gpdp.it/web/guest/temi/cookie

ondequadre commented 2 years ago

I tried the solution you suggested, the third button appears correctly but then if I click it it doesn't work, it doesn't open the settings window.

hi, i had the same problem and this is my solution:

after cookieconsent.run() i simply append a new button to “c-bns” div. Here with jquery:

cookieconsent.run(“stuff to do”); $('#c-bns').append('<button type="button" data-cc="c-settings" class="c-bn c_link" aria-haspopup="dialog">Settings</button>');

not so elegant, but it's a good workaround

@orestbida Great work!

htmlplanet974 commented 2 years ago

It doesn't work because the addlistener instructions have already been called ...

Here is my solution:

For the third button I took the links already inserted in the banner at the end of the text and moved it in position, making it become a button:

var el = $('#c-inr-i #c-txt .cc-link').remove(); el.removeClass('cc-link').addClass('c-bn'); $('#cm #c-bns').prepend(el);

For the question of the closing "X" I added a new element that works as an alias of the "Reject all" button, in practice through a new observer I click on the button already created previously:

$('#cm #c-inr').prepend('<button type="button" id="c-bn-close" class="c-bn c_link">X</button>'); $('#c-bn-close').on('click', function() { $('#c-s-bn').click(); });

then proceed with new CSS rules to customize the position of the new button inserted.

Iris92 commented 2 years ago

Great work htmlplanet974 Thanks

ondequadre commented 2 years ago

Thanks htmlplanet974, it works fine, for now I will use this solution while waiting for the new version 3 to add this functionality.

orestbida commented 2 years ago

We can finally close this issue! All the above discussed layouts/options (including a footer for links) are implemented in v3 (beta)!