Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change theme without saving a cookie #83

Closed
markusressel opened this issue Apr 25, 2021 · 12 comments · May be fixed by #199
Closed

Change theme without saving a cookie #83

markusressel opened this issue Apr 25, 2021 · 12 comments · May be fixed by #199
Labels
enhancement New feature or request question Further information is requested

Comments

@markusressel
Copy link

Hey there, using this module and it works great so far.

Due to GDPR I am not allowed to save things in the user's browser, without receiving their consent first. But, when using:

this.$colorMode.preference = this.currentTheme

a cookie is automatically set. While I understand that the user experience is not exactly great when I can not save the theme selection for the next visit of the user, I still don't want to prevent users that didn't give me their consent (yet!) from trying out the alternative theme.

Is there a way to change the current theme without saving a cookie?

@markusressel markusressel added the question Further information is requested label Apr 25, 2021
Copy link
Contributor

Atinux commented Apr 27, 2021

Hi @markusressel

The cookie is a functional one, not related to user tracking at all, so there should not be any problem regarding it

@markusressel
Copy link
Author

markusressel commented Apr 27, 2021

I don't have the link handy, but what I have read so far wasn't exactly clear on whether this counts as functional or not, so I wanted to be on the safe side. Afaik even a simple language setting does not count as functional. Do you happen to know of websites that do this? Or have a source that is trustworthy?

@pi0
Copy link
Contributor

pi0 commented Apr 27, 2021

checking last code, are we still using cookies? /cc @Atinux (https://github.com/nuxt-community/color-mode-module/blob/master/lib/templates/plugin.client.js)


Regarding cookies, Language and color seems to be same category (preferences/functionality)

https://gdpr.eu/cookies
Preferences cookies — Also known as “functionality cookies,” these cookies allow a website to remember choices you have made in the past, like what language you prefer, what region you would like weather reports for, or what your user name and password are so you can automatically log in.

If you are sure (*) no notice is required for lang, it should be fine. Only i guess max 12M ttl is important.

(*) Receive users’ consent before you use any cookies except strictly necessary cookies.

@markusressel
Copy link
Author

checking last code, are we still using cookies?

Well it's not a cookie but a local storage entry. But that is irrelevant, the GDPR doesn't specifically target cookies only.

(*) Receive users’ consent before you use any cookies except strictly necessary cookies.

I mean, thats the tricky part for me 😄 Beeing able to set a theme imo isn't strictly necessary. It's a convenience feature. Without nuxt color mode my whole site could be used without anything stored anywhere. Thats my goal :)

Copy link
Contributor

Atinux commented May 14, 2021

I see, in that case you should not even display the color switcher until the user approved the consent banner right?

@markusressel
Copy link
Author

markusressel commented May 14, 2021

Again, as mentioned in OP, I would like to let users select a theme, even if it is only used for their current session and not persisted. This is currently not possible, because setting a theme value also sets a cookie. I should probably make the user aware of that with a little tooltip or something, but thats for me to decide.

The theme selection could (and imo should) be fully functional without the cookie, it just doesn't persist for the next session. I think this is a use case that would be beneficial to all GDPR compliant sites. But of course its not a huge issue or anything. I thought it might be pretty easy to separate the cookie from the current theme selection so I asked.

@Atinux Atinux added the enhancement New feature or request label Jun 11, 2021 — with Volta.net
Copy link
Contributor

Atinux commented Jun 11, 2021

From what I see, we could have an option to disable storing the theme into the localStorage but only in memory.

Something like:

export default {
  colorMode: {
    storage: 'memory' // default: 'localStorage'
  }
}

Would that work for you?

But if using the localStorage for this is fine and does not need any GPDR approval, then no need to add such feature.

@markusressel
Copy link
Author

markusressel commented Jun 11, 2021

Yes, I think this would work.

It would also be great if it were possible to change this after the fact using javascript.

Something like this (storage initially set to memory):

$colorMode.storage = 'localStorage'
$colorMode.preference = currentSelection

Copy link
Contributor

Atinux commented Jun 13, 2021

How comfortable are you to open a PR?

@Atinux
Copy link
Contributor

Atinux commented Jun 14, 2021

Actually, we discussed with Pooya and since we won't support many storage, we could have remember: false option (default to true)

@markusressel
Copy link
Author

Would also work 👍

I am not sure if I can find the time to deep dive into the repository and change something without breaking things 😅 If you cannot spare the time I guess I will have to, but it would be very much appreciated if one of you guys were able to work this in. Regardless of the response: Thank you for taking the time! 🤓

@markusressel
Copy link
Author

Closing this due to lack of activity and outdated infos.
Thx for the conversation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants