From 99857456538253dedb34750291fb97d971ace5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 19:09:50 -0400 Subject: [PATCH 1/2] Tooltip: Follow the standard appendTo logic Even though there's no reason to ever configure the parent element via an `appendTo` option, following the standard logic is useful for scrollable elements and native dialogs. Fixes #10739 --- ui/tooltip.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/tooltip.js b/ui/tooltip.js index ae10177223b..d26465e8bc4 100644 --- a/ui/tooltip.js +++ b/ui/tooltip.js @@ -428,7 +428,7 @@ $.widget( "ui.tooltip", { this._addClass( content, "ui-tooltip-content" ); this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); - tooltip.appendTo( this.document[ 0 ].body ); + tooltip.appendTo( this._appendTo( element ) ); return this.tooltips[ id ] = { element: element, @@ -446,6 +446,16 @@ $.widget( "ui.tooltip", { delete this.tooltips[ tooltip.attr( "id" ) ]; }, + _appendTo: function( target ) { + var element = target.closest( ".ui-front,dialog" ); + + if ( !element.length ) { + element = this.document[ 0 ].body; + } + + return element; + }, + _destroy: function() { var that = this; From f542b47e055305cf35a7c562e5a2f0e5586c8e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Mar 2015 19:11:37 -0400 Subject: [PATCH 2/2] All: Include native dialogs in appendTo logic (ui-front walking) Ref #10739 --- ui/autocomplete.js | 2 +- ui/selectmenu.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/autocomplete.js b/ui/autocomplete.js index 209fa71ae99..b9675f30764 100644 --- a/ui/autocomplete.js +++ b/ui/autocomplete.js @@ -365,7 +365,7 @@ $.widget( "ui.autocomplete", { } if ( !element || !element[ 0 ] ) { - element = this.element.closest( ".ui-front" ); + element = this.element.closest( ".ui-front,dialog" ); } if ( !element.length ) { diff --git a/ui/selectmenu.js b/ui/selectmenu.js index 74e142d33d4..10c32417b10 100644 --- a/ui/selectmenu.js +++ b/ui/selectmenu.js @@ -586,7 +586,7 @@ return $.widget( "ui.selectmenu", { } if ( !element || !element[ 0 ] ) { - element = this.element.closest( ".ui-front" ); + element = this.element.closest( ".ui-front,dialog" ); } if ( !element.length ) {