Skip to content

Conversation

@vachmara
Copy link
Contributor

πŸ”— Linked issue

Resolves #4073

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The main issue lies in NavigationMenu specifically in how the default value is set when rendering NavigationMenuItem.

In reka-ui, the library uses the default item value as reference to find the active element:

activeTrigger.value = items.find(item =>
    item.id.includes(modelValue.value),
)

However, this can lead to incorrect matches due to the way IDs are generated. If we inspect the ID generation logic the ID often includes an index, for example: reka-navigation-menu-v-10-trigger-0

In this case, if we hover the second tab, modelValue.value will be equal to 1. The includes check will mistakenly match this ID (because 1 is included in 10), returning the wrong element, typically the first item instead of the second here.

This issue becomes more likely when item values are simple strings like numeric indices ("0", "1", etc.). A more robust comparison would avoid this kind of false-positive match.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vachmara vachmara changed the title fix: navigation menu arrow position conflict fix(UNavigationMenu): arrow position conflict May 12, 2025
@vachmara vachmara marked this pull request as draft May 12, 2025 16:28
@pkg-pr-new
Copy link

pkg-pr-new bot commented May 12, 2025

npm i https://pkg.pr.new/@nuxt/ui@4137

commit: 430986e

@vachmara vachmara marked this pull request as ready for review May 12, 2025 16:49
@benjamincanac benjamincanac changed the title fix(UNavigationMenu): arrow position conflict fix(NavigationMenu): arrow position conflict May 12, 2025
@benjamincanac
Copy link
Member

Thanks for digging this out! 😊

@benjamincanac benjamincanac merged commit 0dc4678 into nuxt:v3 May 13, 2025
6 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 #1289

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UNavigationMenu: Dropdown broken

2 participants