mdbootstrap / TW-Elements

𝙃π™ͺπ™œπ™š collection of Tailwind MIT licensed (free) components, sections and templates 😎
https://tw-elements.com
MIT License
12.85k stars 1.62k forks source link

[DarkMode] [Dark mode class not working with Chrome's default dark theme.] #1849

Open Praveen0369 opened 1 year ago

Praveen0369 commented 1 year ago

Dark mode class not working with Chrome's default dark theme. As a user, I would expect the darkMode class to consistently apply dark styles regardless of the browser's default theme. If possible, adjustments to the darkMode class or additional guidance on handling default browser themes could help address this issue.

To Reproduce Steps to reproduce the behavior:

  1. Create a website using Tailwind CSS.
  2. Implement a darkMode class to enable dark theme on the site.
  3. Load the website in Chrome with its default dark theme enabled.
  4. Observe that the darkMode class does not apply consistent dark styles as expected.

Expected behavior When using the darkMode class to enable dark theme on my site, the dark styles should be applied consistently across different themes, including Chrome's default dark theme

Actual behavior The dark mode styles, applied using the darkMode class, are not functioning correctly when Chrome's default dark theme is active. The styles are not being applied as expected, leading to inconsistent appearance and conflicts with other div elements intended for dark themes.

Show your code `<div className={darkMode ? "dark" : "light"} >

Praveen Prabhakaran

Developer and Designer

Eager fresher seeking dynamic work environment to apply skills, learn, and contribute effectively. Adaptable, motivated, and ready to make a positive impact

` **Desktop (please complete the following information):** - OS: Windows 11 - Browser Chrome - Version 115.0.5790.110 - tailwind css v3.3.3 **Smartphone (please complete the following information):** - Device: Any Android device - OS: Android 11 - Browser chrome, duck duck go - Version 115 (115.0.5790.166)
juujisai commented 1 year ago

Hi I'm not sure if I uderstand correctly. We do not support adding the dark class to a single element. Some of the components have content that is added at the end of body (like Select, Datepicker, Timepicker) and that would make the darkmode not to work properly.

If you want to change the theme, add (or remove) the dark class to the html element if you are using the darkMode: "class" setting in tailwind.config.js.