Open mya-zaki opened 4 years ago
Hi,
apologies for the late reply.
I can confirm the issue. It ~only happens when using webpacker~
Edit: It happens when using @rails/ujs
instead of jquery-ujs
, even without webpacker
@vjt with latest versions @rails/ujs
, it is possible to override Rails.confirm
.
Instead of
we could write:
/**
* Override `Rails.confirm` dialog.
*
* If the modal is visible, it means that the handler is being called by the
* modal commit button click handler, as such the user has successfully
* clicked on the confirm button.
*
* If the modal is not visible, then it is spawned and the default Rails
* confirmation dialog is canceled.
*
*/
Rails.confirm = function (message, el) {
const modal = $(el).getConfirmModal()
if (modal.is(':visible')) {
return true
} else {
modal.spawn()
return false
}
}
It also works on IE11, FWIW
Two windows are displayed when you click the link that has a data-confirm attribute. Please see below.
Versions: