Cookie banner
Dismiss the banner and continue editing
Direct Edit recognizes common cookie banners and leaves opening, closing and animations to the website. These elements receive no editing icons. Change banner text in its source code or in the settings of the service that provides it.
For a custom banner, give your AI the following prompt together with its HTML, CSS and JavaScript. Use an editor version that supports cookie banner recognition.
I use Direct Edit on a static HTML website. Create or adapt the cookie banner so the editor recognizes it and leaves its controls to the website's JavaScript.
- For a custom banner, add the cookie-banner CSS class to its existing container. If it has a separate backdrop, add cookie-overlay to that element. A separate cookie preferences panel can also use the cookie-banner class.
- Preserve existing IDs, classes, content and JavaScript bindings. Add the classes without renaming existing elements. Check that the added classes do not conflict with existing CSS.
- Apply these names only to cookie UI. Do not put them on body, a wrapper around the whole page, ordinary navigation, an accordion or another modal. The exclusion also applies to every descendant of the marked element.
- The editor recognizes cookie-banner and cookie-overlay as IDs too. One form is enough; if a matching ID or class already exists, do not add another marker.
Example of adding classes to existing HTML:
<div id="my-backdrop" class="backdrop cookie-overlay"></div>
<div id="my-banner" class="banner cookie-banner">
...existing content and buttons...
</div>
Direct Edit also recognizes the following names, each as either an ID or a complete CSS class:
- CookieYes: cky-consent-container, cky-modal, cky-overlay, cky-btn-revisit-wrapper
- Cookiebot: CybotCookiebotDialog, CybotCookiebotDialogBodyUnderlay
- OneTrust / CookiePro: onetrust-consent-sdk, onetrust-banner-sdk, onetrust-pc-sdk, onetrust-pc-dark-filter
- Complianz: cmplz-cookiebanner-container, cmplz-cookiebanner, cmplz-soft-cookiewall, cmplz-manage-consent
- Custom banners: cookie-banner, cookie-overlay
For a recognized service, preserve its own structure and names. Matching is exact: cookie-policy-text, for example, is not automatically excluded.
Expected behavior:
- The editor does not hide or open the banner itself, or grant consent on the user's behalf. Visibility still depends on the website code and the visitor's stored choice.
- The editor does not force the recognized banner, backdrop or descendants to appear and adds no editing or duplication controls. Animations can remain. This also applies to elements inserted later by JavaScript.
- Preserve acceptance, rejection and a link to reopen settings. Closing must also hide the backdrop and release any scroll or focus lock owned by the banner.
- Attach button handlers through addEventListener; the editor removes inline handlers such as onclick from the preview. Closing the interface must not depend on external tracking being available.
- Do not change editor files or invent new data-* attributes. A matching name alone cannot fix a broken banner script or make the preview load an external service it filters out.
Verify on both the public page and in the editor: first visit, acceptance, rejection, reload and reopening settings. After closing, the page must respond and scroll. In the editor, then open and save an ordinary text edit. Check desktop and mobile. Test actual tracking and consent changes on the public website.