[FIX] web: dialog: remove setTimeout making tests fail
... sometimes. When a dialog is destroyed, the last opened dialog (the one which is just below), if any, is focused. This allows to close it directly by pressing ESC. For an unknown reason, this was done in a setTimeout (delay 0). The problem is that the setTimeout made some JS tests fail randomly, when a test ending by closing a dialog was executed right before a test using a many2one inside a dialog. When this happened, the second test failed sometimes because its dialog was focused (because of the previous test) while waiting for the autocomplete dropdown to open, triggering a blur event on the m2o input, and thus making jquery autocomplete aborting the search, and the opening of the dropdown.
This commit is contained in:
committed by
Géry Debongnie
parent
c2563dbb0d
commit
b7c92ecaac
@@ -151,13 +151,12 @@ var Dialog = Widget.extend({
|
||||
this.$modal.modal('hide');
|
||||
this.$modal.remove();
|
||||
|
||||
setTimeout(function () { // Keep class modal-open (deleted by bootstrap hide fnct) on body to allow scrolling inside the modal
|
||||
var modals = $('body > .modal').filter(':visible');
|
||||
if(modals.length) {
|
||||
modals.last().focus();
|
||||
$('body').addClass('modal-open');
|
||||
}
|
||||
}, 0);
|
||||
var modals = $('body > .modal').filter(':visible');
|
||||
if (modals.length) {
|
||||
modals.last().focus();
|
||||
// Keep class modal-open (deleted by bootstrap hide fnct) on body to allow scrolling inside the modal
|
||||
$('body').addClass('modal-open');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user