cookieconsent icon indicating copy to clipboard operation
cookieconsent copied to clipboard

[Feat]: Expose the event that triggered onModalShow/onModalHide callback function

Open peaemaye opened this issue 1 year ago • 0 comments

Description

When using the onModalShow() callback function it can be useful to know what triggered it. An easy way to achieve this is to expose the event that triggered the callback allowing us to check the event.target or other info.

In may case I wanted to auto-expand a third party services section if it was opened from a static button using: data-cc='show-preferencesModal', but not if it was opened from the button in the standard consent modal.

Proposed solution

See PR #706

Additional details

I've put together a quick StackBlitz to show this in action: https://stackblitz.com/edit/stackblitz-starters-9caf9y?file=index.js

peaemaye avatar Jul 15 '24 14:07 peaemaye