Skip to content

Conversation

heyjorgedev
Copy link

The way that we assert that a menu is active changed on the following commit (21e50ce#diff-e93188a864f7af449d4b29df16b91db77b206f891eef34b28856d7b5565e537dL111-R112) to use wayfinder but the same condition was not being applied on the active menu selector, this PR fixes it.

@thewebartisan7
Copy link

thewebartisan7 commented Sep 22, 2025

Regarding the header menu active item style, I also notice that the const activeItemStyles = 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100'; has no effect visually.

Like for sidebar, adding data-active=true add the same background color when link is active:

<Link
                                            href={item.href}
                                            className={cn(
                                                navigationMenuTriggerStyle(),
                                                'h-9 cursor-pointer px-3',
                                            )}
                                            data-active={page.url === (typeof item.href === 'string' ? item.href : item.href.url)}
                                        >
                                            {item.icon && <Icon iconNode={item.icon} className="mr-2 h-4 w-4" />}
                                            {item.title}
                                        </Link>

@heyjorgedev
Copy link
Author

@thewebartisan7 that one I think its fine, the author just doesn't have a like a bg-neutral-"200" on the const activeItemStyles = 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100';, in dark mode you can see the selected menu thingy.

I think...

@thewebartisan7
Copy link

@thewebartisan7 that one I think its fine, the author just doesn't have a like a bg-neutral-"200" on the const activeItemStyles = 'text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100';, in dark mode you can see the selected menu thingy.

I think...

Considering that shadcn are already using data-active classes like data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground, I think that is better to re-use this rather than creating additional ones. The same is being used to set sidebar active state

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

Successfully merging this pull request may close these issues.

2 participants