abereghici / remix-themes

An abstraction for themes in your Remix app.

Home Page:https://www.npmjs.com/package/remix-themes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use data-themes attribute instead of class on html tag

revelt opened this issue · comments

Describe the bug

Currently, we set a class on html tag, which works, but is not a good practice.

What if we used data-theme attribute instead?

<html data-theme="dark">

Your Example Website or App

n/a

Steps to Reproduce the Bug or Issue

n/a

Expected behavior

n/a

Screenshots or Videos

No response

Platform

all

Additional context

No response

Hey @revelt, thanks for opening this issue and for your feedback. I updated the demo app and the README to use data attribute instead of className.

@abereghici Awesome! Thank you! It's very solid, works as promised. I only see the theme state being reset on Safari, but that's probably its privacy-related safeguards. Theoretically, if we decide to look into it, we should look into ways to supplement the cookie-sessions with localstorage backup, to nail Safari. Other than that, all super!

@revelt I just created a new issue to investigate the Safari problem.