data-confirm-modal
data-confirm-modal copied to clipboard
Both the modal and the confirm-window are displayed on IE11.
Two windows are displayed when you click the link that has a data-confirm attribute.
Please see below.
Versions:
- Internet Explorer: 11
- Ruby: 2.6.5
- Rails: 5.2.4
- data-confirm-modal: 1.6.3
- Bootstrap: 4.4
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
Demo: https://jsbin.com/lejopuq/
@vjt with latest versions @rails/ujs
, it is possible to override Rails.confirm
.
Instead of
https://github.com/ifad/data-confirm-modal/blob/139459fb5be2821818bcb138460919aee5d8b1b5/vendor/assets/javascripts/data-confirm-modal.js#L315-L355
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