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

fix(menu)/dropdown menu selection #3710

Open
wants to merge 5 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silly-cooks-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/menu": patch
---

The condition for data-selectable now includes isHovered along with isSelectable.This ensures that the item can be selected when it is hovered over, addressing the issue where the selection stays in the same place when the cursor moves out of the menu.This change should help fix the dropdown selection functionality on mobile devices and improve the user experience.
2 changes: 1 addition & 1 deletion packages/components/menu/src/use-menu-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function useMenuItem<T extends object>(originalProps: UseMenuItemProps<T>
props,
),
"data-focus": dataAttr(isFocused),
"data-selectable": dataAttr(isSelectable),
"data-selectable": dataAttr(isHovered && isSelectable),
"data-hover": dataAttr(isMobile ? isHovered || isPressed : isHovered),
"data-disabled": dataAttr(isDisabled),
"data-selected": dataAttr(isSelected),
Expand Down