Skip to content

Menu: Handle mouse movement mixed with keyboard navigation #1805

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

Closed
wants to merge 1 commit into from

Conversation

scottgonzalez
Copy link
Member

Fixes #9357

@jsf-clabot
Copy link

jsf-clabot commented Apr 18, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@@ -78,6 +78,8 @@ return $.widget( "ui.menu", {
// them (focus should always stay on UL during navigation).
"mousedown .ui-menu-item": function( event ) {
event.preventDefault();

this._activateItem( event );
Copy link
Member Author

Choose a reason for hiding this comment

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

We activate on mousedown to handle the scenario of moving the mouse over an item, navigating away from that item with they keyboard, then clicking with the mouse. Since we won't get a mouseenter or mousemove, we need to activate on mousedown. This matches the OS X menu behavior.

@@ -107,29 +109,8 @@ return $.widget( "ui.menu", {
}
}
},
"mouseenter .ui-menu-item": function( event ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This method was moved to _activateItem().

// If the item is already active, there's nothing to do
if ( target.is( ".ui-state-active" ) ) {
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This conditional is the only thing that changed in this method. This is just the avoid the expensive work that follows.

@scottgonzalez scottgonzalez deleted the menu-mouse branch May 2, 2017 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants