question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow custom styling for consent banner

See original GitHub issue

Right now the consent banner is styled one-size-fits-all. While we try to keep it low-impact for most designs, this surely hurts adoption in cases where a unified UX is important for operators.

While it’s technically trivial to allow operators to inject custom CSS into the iframe element that displays the banner, this also comes with some pitfalls and requirements:

  • Operators should not be able to alter the content in the banner (i.e. change wording to be misleading or hide certain elements)
  • The default a11y and privacy standards must be preserved in any case

Approach: allowing operators to define custom CSS per account

Semantic classes are applied to the markup that displays the consent banner. Operators can now add custom CSS for each account which the server will add (in addition to the predefined styles) to each vault response. In order to prevent operators from creating a misleading consent banner the following sanitzation rules are applied to the CSS before saving:

  • no pseudo content
  • no hiding of elements
  • no opacity rules

Pros

  • Allows operators to apply fine grained styling that matches virtually any site design
  • Technically simple to implement

Cons

  • Sanitizing CSS will help, but it will not close all loopholes for malicious use ever (then again, forking Offen is a lot easier and gives you all options)
  • Does not offer a middle ground for non-technically savvy users that don’t want to / cannot write CSS but still want to customize their banner’s appearace

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
whalehubcommented, Apr 28, 2021

@m90 I love how you implemented this feature, what with the preview function and everything - well done! The documentation was more than sufficient for me personally.

Before

img

After

img

Edit: The subtle yellow tint is from LightBulb running while I was taking the screenshots.

2reactions
m90commented, Apr 21, 2021

I don’t have the time to give this much thought from a development point of view in this moment.

Your requirements as a user are super helpful and all we need. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add custom styles to cookie consent banner
This is exactly why we have introduced a custom CSS styling option. Go to your CookieScript user account > Settings > Design, where...
Read more >
How to Add Custom CSS to Your Cookie Consent Banner
CookieYes enables you to change the appearace of your cookie consent banner by adding custom styles to the banner using the custom CSS...
Read more >
Customize GDPR cookie banner using CSS - WebToffee
GDPR cookie consent plugin allows you to customize the cookie banner in different ways. Following are some of the sample code snippets by ......
Read more >
Customizing the Banner Template - CookiePro Community
On the Cookie Consent menu, select Templates. The Templates screen appears. Click on the name of the template you want to customize. The...
Read more >
Changing the CSS of cookie consent banner in Secure Privacy
Customize your cookie consent banners with CSS using this guide · Navigate to Banners Cookie Banner Add custom CSS. · Paste your CSS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found