Skip to content

Commit 56de22e

Browse files
committed
Tooltip: Avoid infinite recursion when disabling a tooltip on close.
1 parent a51451d commit 56de22e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ui/jquery.ui.tooltip.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ $.widget( "ui.tooltip", {
173173
target = $( event ? event.currentTarget : this.element ),
174174
tooltip = this._find( target );
175175

176+
// disabling closes the tooltip, so we need to track when we're closing
177+
// to avoid an infinite loop in case the tooltip becomes disabled on close
178+
if ( this.closing ) {
179+
return;
180+
}
181+
176182
// don't close if the element has focus
177183
// this prevents the tooltip from closing if you hover while focused
178184
if ( !force && this.document[0].activeElement === target[0] ) {
@@ -195,7 +201,9 @@ $.widget( "ui.tooltip", {
195201
target.removeData( "tooltip-open" );
196202
target.unbind( "mouseleave.tooltip focusout.tooltip keyup.tooltip" );
197203

204+
this.closing = true;
198205
this._trigger( "close", event, { tooltip: tooltip } );
206+
this.closing = false;
199207
},
200208

201209
_tooltip: function( element ) {

0 commit comments

Comments
 (0)