cookieconsent icon indicating copy to clipboard operation
cookieconsent copied to clipboard

[Feat]: Reuse the "#cc-main" element where possible

Open codebymikey opened this issue 5 months ago • 0 comments

Description

This is useful for sites which might want the cookie consent form to be rendered in a specific place on the page, e.g. above the rest of the page content e.g. https://www.gov.uk/

Image

Proposed solution

The site can declare a placeholder <div id="cc-main"></div> on the page. The library should then check if the #cc-main element exists on the page, and reuse it rather than creating a duplicate.

https://github.com/orestbida/cookieconsent/blob/c3882de2822a26eb9842c8b019d228374cf9b075/src/core/modals/index.js#L13-L14

Additional details

No response

codebymikey avatar Jul 31 '25 08:07 codebymikey