Skip to content

Commit 3c8ea24

Browse files
committed
Merge #19960 - Fix #19950 - Dispose tooltips when Enter is pressed
Pull-request: #19960 Fixes: #19950 Signed-off-by: William Desportes <williamdes@wdes.fr>
2 parents 2c1a942 + c8acafe commit 3c8ea24

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

resources/js/modules/ajax-message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
9696
// Update message count to create distinct message elements every time
9797
ajaxMessageCount++;
9898
// Remove all old messages, if any
99+
$('[role="tooltip"]').remove();
99100
$('span.ajax_notification[id^=ajax_message_num]').remove();
100101
/**
101102
* @var $retval a jQuery object containing the reference

resources/js/modules/functions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ export function addDateTimePicker () {
198198

199199
// Add a tip regarding entering MySQL allowed-values for TIME and DATE data-type
200200
if (this.classList.contains('timefield')) {
201-
bootstrap.Tooltip.getOrCreateInstance(this, { title: window.Messages.strMysqlAllowedValuesTipTime })
201+
bootstrap.Tooltip.getOrCreateInstance(this, { title: window.Messages.strMysqlAllowedValuesTipTime, trigger: 'hover' })
202202
.setContent({ '.tooltip-inner': window.Messages.strMysqlAllowedValuesTipTime });
203203
} else if (this.classList.contains('datefield')) {
204-
bootstrap.Tooltip.getOrCreateInstance(this, { title: window.Messages.strMysqlAllowedValuesTipDate })
204+
bootstrap.Tooltip.getOrCreateInstance(this, { title: window.Messages.strMysqlAllowedValuesTipDate, trigger: 'hover' })
205205
.setContent({ '.tooltip-inner': window.Messages.strMysqlAllowedValuesTipDate });
206206
}
207207
});
@@ -1521,7 +1521,7 @@ export function dismissNotifications () {
15211521
displayCopyStatus(this, copyStatus);
15221522
});
15231523

1524-
$(document).on('mouseover mouseleave', '.ajax_notification a', function (event) {
1524+
$(document).on('mouseover mouseleave', 'span.ajax_notification.dismissable a', function (event) {
15251525
let message = window.Messages.strDismiss;
15261526

15271527
if (event.type === 'mouseover') {

resources/js/table/select.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import $ from 'jquery';
2+
import * as bootstrap from 'bootstrap';
23
import { AJAX } from '../modules/ajax.ts';
34
import { addDatepicker, prepareForAjaxRequest } from '../modules/functions.ts';
45
import { CommonParams } from '../modules/common.ts';
@@ -118,6 +119,14 @@ AJAX.registerOnload('table/select.js', function () {
118119
var $searchForm = $(this);
119120
event.preventDefault();
120121

122+
// Dispose tooltips. See #19950
123+
$('input.datefield, input.timefield').each(function () {
124+
const tooltipInstance = bootstrap.Tooltip.getInstance(this);
125+
if (tooltipInstance) {
126+
tooltipInstance.dispose();
127+
}
128+
});
129+
121130
// empty previous search results while we are waiting for new results
122131
$('#sqlqueryresultsouter').empty();
123132
var $msgbox = ajaxShowMessage(window.Messages.strSearching, false);

0 commit comments

Comments
 (0)