Skip to content

Fix dropdown menu item mouse events#106

Merged
ealmloff merged 1 commit intoDioxusLabs:mainfrom
Leaf-Computer:gh-105
Aug 7, 2025
Merged

Fix dropdown menu item mouse events#106
ealmloff merged 1 commit intoDioxusLabs:mainfrom
Leaf-Computer:gh-105

Conversation

@danieldaquino
Copy link
Contributor

@danieldaquino danieldaquino commented Aug 7, 2025

This commit fixes an issue where dropdown menu items could not be clicked with a mouse, because the menu would close before the click event could complete.

This was fixed by preventing blur from happening during mousedown and have it occur after mouseup instead, thus allowing click events to be fired.

Testing

Dioxus Primitives: 04134ae

Browsers:

  • Safari 18.6
  • Firefox 141.0.3

Steps:

  1. Run preview app (dx serve -p preview --platform web)
  2. Navigate to dropdown menu page (/component/?name=dropdown_menu)
  3. Click on the "Open Menu" button
  4. Click on any item
  5. Check the logs from the dx command, and ensure there is a log in the format "Selected: {value}", indicating the on_select event was triggered by the click.
  6. Try triggering the menu items using the keyboard and ensure the corresponding logs appear
  7. Try clicking outside the dropdown menu once it is open, ensure the menu gets closed.

Results: Works as expected

This commit fixes an issue where dropdown menu items could not be
clicked with a mouse, because the menu would close before the click event
could complete.

This was fixed by preventing blur from happening during mousedown and
have it occur after mouseup instead, thus allowing click events to be
fired.

Closes: DioxusLabs#105
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

@danieldaquino
Copy link
Contributor Author

@ealmloff, please let me know if you have any suggestions or concerns. Thank you!

@ealmloff ealmloff self-requested a review August 7, 2025 21:13
Copy link
Member

@ealmloff ealmloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@ealmloff ealmloff merged commit 4ca8fd5 into DioxusLabs:main Aug 7, 2025
10 checks passed
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