corbado / javascript

MIT License
6 stars 1 forks source link

Make sure that dark mode works as expected #315

Closed incorbador closed 1 week ago

incorbador commented 2 weeks ago

Why

During integration into our dev panel @Aby-JS noticed that our dark mode setting does not behave as expected when combined with style customizations (i.e. a custom theme). Expected behaviour is:

TODOS

Here you must list all the TODOS using TODO checkboxes (markdown).

Aby-JS commented 2 weeks ago

Cause: This error is related to CSS class specificity. Links for Github issues reporting this: Vite Issue and Nuxt + Vite Issue Fix: can be fixed by increasing the specificity of the custom class like with body.corbado-auth

Note: This is related to Vite v3 which is being used by developer panel and since we are using Vite v5 in our WebJS demo we did not faced this issue there.

Aby-JS commented 2 weeks ago

Fact: In a usual scenario, the stylings for dark mode and light mode are similar except for colors. Solution: We have made sure to introduce a bulk of CSS variables which can be overwritten for dark mode and light mode in our customer's CSS themes. The approach for that will be to write stylings for .customers-custom-theme which will apply for both light mode and dark mode. And then for dark mode specific stylings the customer/developer can just use a more specific selector like .cb-dark.customers-custom-theme. This will work.