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

bug: Navbar/Tab Navigation Not Switching Correctly in DaisyUI Version 4.12.22 #3333

Closed
FerdianFy13 opened this issue Dec 23, 2024 · 2 comments

Comments

@FerdianFy13
Copy link

What version of daisyUI are you using?

v4.12.22

Which browsers are you seeing the problem on?

Chrome

Reproduction URL

https://daisyui.com/components/dropdown/

Describe your issue

In DaisyUI version 4.12.22, there is an issue with the Navbar or Tab Navigation component where the active item does not switch when selecting a new item. The switch only happens after the page is reloaded.

Steps to Reproduce

Install DaisyUI version 4.12.22.
Create a Navbar or Tab Navigation component.
Click on the first item (e.g., "Home").
Click on the second item (e.g., "About").
Notice that the component remains on the initial item ("Home") and does not switch to the new item ("About").
Reload the page, and only then does the active item switch.
Expected Behavior
The Navbar or Tab Navigation should immediately switch to the selected item without requiring a page reload.

Actual Behavior
The active item stays on the initial item, and only switches after reloading the page.

Environment

DaisyUI version: 4.12.22
Framework: Tailwind CSS
Browser: Chrome version 131.0.6778.205 (Official Build) (64-bit)
Operating System: Windows 11
Additional Information
This issue seems to occur when the application has been idle for a long time. It could be related to DaisyUI's internal state management or a conflict with Tailwind CSS.

Temporary Workaround
Reloading the page resolves the issue temporarily, but this is not an ideal solution.

Copy link

Thank you @FerdianFy13 for reporting issues. It helps daisyUI a lot 💚
I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
In the meantime providing more details and reproduction links would be helpful.

@saadeghi
Copy link
Owner

saadeghi commented Dec 24, 2024

My friend, daisyUI is a CSS framework. CSS is for styles, not routing…

When your first item has an "active" class, clicking it is not going to magically move the class name to the next item. You should add the active class, based on your JS framework or routing library. For example if you are using a JS framework, you should compare the current path with the path of the link, then if it was same, you add the "active" class. This way framework will change the class to the next item when you click it.

Let me know if you have a question.

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