Skip to content

Commit 241c100

Browse files
jzaeffererscottgonzalez
authored andcommitted
Tooltip: Check type on event directly, preventing TypeError when programmatically moving focus to track-toolipped-input. Fixes #8747 - Tooltip: Using the track option within dialogs creates JS errors
(cherry picked from commit 98173a3)
1 parent 9e0071f commit 241c100

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tests/unit/tooltip/tooltip_options.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,12 @@ test( "track + show delay", function() {
146146
equal( $( ".ui-tooltip" ).css( "top" ), topVal + offsetVal + "px" );
147147
});
148148

149+
test( "track and programmatic focus", function() {
150+
expect( 1 );
151+
$( "#qunit-fixture div input" ).tooltip({
152+
track: true
153+
}).focus();
154+
equal( "inputtitle", $( ".ui-tooltip" ).text() );
155+
});
156+
149157
}( jQuery ) );

ui/jquery.ui.tooltip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ $.widget( "ui.tooltip", {
252252
}
253253
tooltip.position( positionOption );
254254
}
255-
if ( this.options.track && event && /^mouse/.test( event.originalEvent.type ) ) {
255+
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
256256
this._on( this.document, {
257257
mousemove: position
258258
});

0 commit comments

Comments
 (0)