diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js
index 52cbe156b9..89f23a4846 100644
--- a/awx/ui/client/src/shared/directives.js
+++ b/awx/ui/client/src/shared/directives.js
@@ -477,7 +477,8 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
return {
link: function(scope, element, attrs) {
var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100},
- placement;
+ placement,
+ stateChangeWatcher;
if (attrs.awTipPlacement) {
placement = attrs.awTipPlacement;
}
@@ -493,6 +494,22 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
template = '
';
}
+ // This block helps clean up tooltips that may get orphaned by a click event
+ $(element).on('mouseenter', function() {
+ if(stateChangeWatcher) {
+ // Un-bind - we don't want a bunch of listeners firing
+ stateChangeWatcher();
+ }
+ stateChangeWatcher = scope.$on('$stateChangeStart', function() {
+ // Go ahead and force the tooltip setTimeout to expire (if it hasn't already fired)
+ $(element).tooltip('hide');
+ // Clean up any existing tooltips including this one
+ $('.tooltip').each(function() {
+ $(this).remove();
+ });
+ });
+ });
+
$(element).on('hidden.bs.tooltip', function( ) {
// TB3RC1 is leaving behind tooltip elements. This will remove them
// after a tooltip fades away. If not, they lay overtop of other elements and