mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Autocomplete: Restore focus after clicking a menu item, if necessary
Fixes #9201
Closes gh-1470
(cherry picked from commit 581bfb55bf
)
This commit is contained in:
parent
2256eeda45
commit
9ac18234e1
@ -221,6 +221,16 @@ $.widget( "ui.autocomplete", {
|
|||||||
this.cancelBlur = true;
|
this.cancelBlur = true;
|
||||||
this._delay(function() {
|
this._delay(function() {
|
||||||
delete this.cancelBlur;
|
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
|
// clicking on the scrollbar causes focus to shift to the body
|
||||||
|
Loading…
Reference in New Issue
Block a user