Skip to content

dark variant not applied when using system mode #6433

@zimt28

Description

@zimt28

Environment

  • Phoenix version (mix deps): 1.8.0

Actual behavior

Using the dark prefix doesn't work when the selected theme is system. Selecting dark adds the data-theme="dark" attribute to the document and

@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));

applies it. When the system switches to dark mode and the selected theme is not dark, Tailwind doesn't apply the variant as it doesn't know the color mode has changed:

Now instead of dark:* utilities being applied based on prefers-color-scheme, they will be applied whenever the dark class is present earlier in the HTML tree

from Tailwind docs

Expected behavior

Using the system theme should pick up dark mode.

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