From b336808423c36b1a3ac207c10b5c485d76ffe2b8 Mon Sep 17 00:00:00 2001 From: Jim Brandt Date: Wed, 3 May 2023 10:51:21 -0400 Subject: [PATCH] Hide tooltips everywhere on click When clicking on the filter icon on ticket search results, the tooltip remained on the screen, sometimes blocking the modal. Add JS to hide tooltips everywhere on click and remove some previous individual fixes for the same issue. Keep the dispose for bookmarks as the "Remove" tooltip persists and is visible behind "Add" when toggling back and forth if dispose isn't called to clean it up. --- share/static/js/forms.js | 7 ------- share/static/js/util.js | 10 ++++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/share/static/js/forms.js b/share/static/js/forms.js index cfb3b3071a6..bf12c954061 100644 --- a/share/static/js/forms.js +++ b/share/static/js/forms.js @@ -33,13 +33,6 @@ jQuery(function() { }).on('click', '.remove', function (e) { e.preventDefault(); jQuery(e.target).closest('li').remove(); - - // dispose of the bootstrap tooltip. - // without manually clearing here, the tooltip lingers after clicking remove. - var bs_tooltip = jQuery('div[id^="tooltip"]'); - bs_tooltip.tooltip('hide'); - bs_tooltip.tooltip('dispose'); - return false; }); diff --git a/share/static/js/util.js b/share/static/js/util.js index 842ee3ecd9c..32fb5b0fd28 100644 --- a/share/static/js/util.js +++ b/share/static/js/util.js @@ -1203,7 +1203,6 @@ jQuery(function () { var cancelInlineEdit = function (editor) { var cell = editor.closest('td'); - cell.find('[data-toggle=tooltip]').tooltip('hide'); cell.removeClass('editing'); editor.get(0).reset(); @@ -1217,7 +1216,6 @@ jQuery(function () { var submitInlineEdit = function (editor) { var cell = editor.closest('td'); - cell.find('[data-toggle=tooltip]').tooltip('hide'); if (!inlineEditEnabled) { return; @@ -1419,15 +1417,19 @@ jQuery(function() { selector: '[data-toggle=tooltip]', trigger: 'hover focus' }); + + // Hide the tooltip everywhere when the element is clicked + jQuery('[data-toggle="tooltip"]').click(function () { + jQuery('[data-toggle="tooltip"]').tooltip("hide"); + }); }); // toggle bookmark for Ticket/Elements/Bookmark. -// before replacing the bookmark content, hide then dispose of the existing tooltip to +// before replacing the bookmark content, dispose of the existing tooltip to // ensure the tooltips are cycled correctly. function toggle_bookmark(url, id) { jQuery.get(url, function(data) { var bs_tooltip = jQuery('div[id^="tooltip"]'); - bs_tooltip.tooltip('hide'); bs_tooltip.tooltip('dispose'); jQuery('.toggle-bookmark-' + id).replaceWith(data); });