Skip to content

Fix problems with content async ajax request #1272

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
Closed
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
20 changes: 16 additions & 4 deletions ui/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ return $.widget( "ui.tooltip", {
}
});
}

// Set mouseover events so we can actually call close even before the _open function is called
// This is needed voor async ajax requests
var events = {};
if ( !event || event.type === "mouseover" ) {
events.mouseleave = "close";
}
if ( !event || event.type === "focusin" ) {
events.focusout = "close";
}
this._on( true, target, events );

this._updateContent( target, event );
},
Expand All @@ -207,10 +218,6 @@ return $.widget( "ui.tooltip", {
}

content = contentOption.call( target[0], function( response ) {
// ignore async response if tooltip was closed already
if ( !target.data( "ui-tooltip-open" ) ) {
return;
}
// IE may instantly serve a cached response for ajax requests
// delay this call to _open so the other call to _open runs first
that._delay(function() {
Expand All @@ -231,6 +238,11 @@ return $.widget( "ui.tooltip", {
},

_open: function( event, target, content ) {
// ignore async response if tooltip was closed already
if ( !target.data( "ui-tooltip-open" ) ) {
return;
}

var tooltip, events, delayedShow, a11yContent,
positionOption = $.extend( {}, this.options.position );

Expand Down