Anthony Dillon
on 19 February 2021

Supporting “I don’t care about cookies”


This article is more than 4 year s old.

It all started one day when my boss turned to me and said, the legal team have said we need to ask a person before our websites can start using non-essential cookies. So we started the cookie-policy project which is written in vanilla JavaScript with accompanying styling and the back-end implemented via Google Tag Manager.

The cookie-policy project displays a modal to each first-time visitor to manage which cookies they would like to accept. We have rolled out successfully across over 30 of our sites.

Recently we received an issue that there was no way to scroll on our site if you were using a popular browser extension named I don’t care about cookies. The cookie policy script added a class to the body of the site to lock scrolling as it was expecting the cookie management modal to be present. The plugin has a range of selectors targeting known cookie notification elements and hides the cookie modal making it impossible for users to remove the scroll lock. 

How to support the extension

Here is a subset of the CSS injected into the site by the plugin. As you can see .cookie-policy is targeted and happens to be the container class used by our cookie-policy.

#stickyCookieBar, 
.cookiebar-bar:not(body):not(html), 
#sliding-popup, 
#cookie_bar_top, 
#cookielaw:not(.modal),
[ … ]
.cookie-policy:not(body):not(html),
[ … ]
#cookiebnr, 
#cookieWarning, {
    display: none !important;
    ...
}

There are a few body classes but they have been kept to a minimum for good reason.

This isn’t what we want to happen and we believe it’s important to respect the wishes of our users so we want to support this extension. Therefore we removed the scroll lock after the cookie management modal appeared as there was no way to identify if the modal was being hidden via this extension.

So if you have written a cookie policy widget for your site or application try and support the extension by using one of the supported selectors and also try and keep it self contained within that element to limit issues such as we expereinced.


Newsletter
signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts


Lyubomir Popov
23 June 2025

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Article Ubuntu

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves to dramatically reduce, or even eliminate, the need for constant design involvement in the day-to-day creation of web pages. Our strategy for achieving this is based on a smarter, more structured approach to content....

Lyubomir Popov
23 June 2025


Leia Ruffini
14 April 2025

How we ran an effective sprint to refresh our website, Part 1

Article Design

Part 1 of how we ran a design sprint to refresh our website. Sharing what worked, what didn’t, and lessons from designing for open source in mind.

Leia Ruffini
14 April 2025


Lyubomir Popov
17 February 2025

A deep dive into our grid system and typography for the A4 format

Article Ubuntu

We recently redesigned our whitepapers as part of our broader rebranding project. Let’s look at some of the ideas behind our approach to layout and typography. The goal? A reliable, accessible modular system that communicates with clarity, purpose and precision across mediums — qualities that tie directly back to our...

Lyubomir Popov
17 February 2025