Block Google Cookie Consent with uBlock

Update: Added additional filters to block the “Please Log In” popup at YouTube.

Opt ins to cookies have become a very annoying issue if you have your browser configured to remove cookies often. Your consent to all the necessary cookies are stored in a cookie. If you, like me, configured your browser to remove cookies after close or are surfing the web in private tabs, then you’ll see the consent dialogs very often.

For some sites that you visit often, this can be extra annoying. One such examples is Google. They started aggressively pushing a consent dialog like this on its main search and maps page:

uBlock has the possibility to block the dialog, but does at this point in time not provide rules to remove the consent dialog. When you block the banner using the block element feature of uBlock, then you’ll not be able to use the scroll bars.

Several posts have described ways to block this, but some of them are specific to the global site or some localizations of the google site, but do not work for all. Also, several hints do not include the consent dialog on Google maps. Some of them only work for Chrome others only for Firefox.

After some searching and try and error, I found two block rules that work reliably on Firefox and Chromium for me:

google.*##.widget-consent-fullscreen.widget-consent
||consent.google.com^
google.*##+js(aeld, DOMContentLoaded, CONSENT)
www.google.*##div[jsname][jsaction^="dg_close"]
www.google.*##html:style(overflow: visible !important;)
www.google.*###lb
youtube.com##ytd-popup-container
youtube.com##ytd-consent-bump-lightbox.style-scope
www.youtube.com##.opened

You can add them to the Ublock configuration in My filters: