Skip to content

Theme switcher - Remove auto from the list of themes #2147

Open
@raphigaziano

Description

@raphigaziano

Hi.

When toggling between themes, the click seems to be a no-op whenever it switches from or to the os/browser's preferred theme.

This is because if my preferred theme is, say, "dark", then the theme attribute is set to "dark" when switching to auto, and stays at the same value when it then switches to "dark".

I removed the auto string from the themeList array, and kept the logic for handling it as an argument to setTheme and defaulting to it if no variable is set in localStorage, which seems to fix the issue.

I can submit a PR with the fix it that clears things up.

Not quite related, but I don't quite understand why the theme in stored in two different attributes (data-theme and data-user-theme). Does it make a difference when styling ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions