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

When disabling dark mode, browser elements such as input type="datetime-local" still are in dark mode, causing the icon to disappear #6777

Open
StudioTomas01 opened this issue Feb 3, 2025 · 1 comment

Comments

@StudioTomas01
Copy link

StudioTomas01 commented Feb 3, 2025

Describe the bug
I wanted to disable dark mode and set the default color scheme to light. Everything is fine, except for example the default browser datepicker, which is still in dark mode, which causes the icon to disappear. The attributes data-bs-theme="light" and style="color-scheme: light;" aren't applied on the body tag with this combination of settings.

To Reproduce
Symfony 7.2.2 and EasyAdminBundle 4.23.3. Default system setting (MacOs) is dark theme. Chrome version 132.0.6834.160.

public function configureDashboard(): Dashboard
{
    return Dashboard::new()
        ->setDefaultColorScheme('light')
        ->disableDarkMode()
    ;
}

(OPTIONAL) Additional context
I fixed it using the following:

{# templates/bundles/EasyAdminBundle/layout.html.twig #}
{% extends '@!EasyAdmin/layout.html.twig' %}

{% block body_attr %}
    data-bs-theme="light" style="color-scheme: light;"
    {{ parent() }}
{% endblock %}
@bastien70
Copy link
Contributor

Hello, I confirm what the author says, and provide some clarifications.

When you deactivate dark mode, several fields automatically switch to dark mode directly, such as select, file, checkbox type fields (in filters)

To reproduce, simply clone the easyadmin demo https://github.com/EasyCorp/easyadmin-demo and disable darkMode in the dashboard controller :

    public function configureDashboard(): Dashboard
    {
        return Dashboard::new()
            ->disableDarkMode()
            ->setTitle('New Easyadmin Demo');
    }

And you get this :

Image

Example with select and file inputs :

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants