Skip to content
Permalink
Browse files

Autocomplete: Restore focus after clicking a menu item, if necessary

Fixes #9201
Closes gh-1470
  • Loading branch information...
scottgonzalez committed Mar 6, 2015
1 parent f330278 commit 581bfb55bf4f4f614a6e0c0ac545cf1aa7d29d0a
Showing with 10 additions and 0 deletions.
  1. +10 −0 ui/autocomplete.js
@@ -229,6 +229,16 @@ $.widget( "ui.autocomplete", {
this.cancelBlur = true;
this._delay(function() {
delete this.cancelBlur;

// Support: IE 8 only
// Right clicking a menu item or selecting text from the menu items will
// result in focus moving out of the input. However, we've already received
// and ignored the blur event because of the cancelBlur flag set above. So
// we restore focus to ensure that the menu closes properly based on the user's
// next actions.
if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
this.element.focus();
}
});

// clicking on the scrollbar causes focus to shift to the body

0 comments on commit 581bfb5

Please sign in to comment.
You can’t perform that action at this time.