data-confirm-modal icon indicating copy to clipboard operation
data-confirm-modal copied to clipboard

Both the modal and the confirm-window are displayed on IE11.

Open mya-zaki opened this issue 4 years ago • 2 comments

Two windows are displayed when you click the link that has a data-confirm attribute. Please see below. issue_ie11

Versions:

  • Internet Explorer: 11
  • Ruby: 2.6.5
  • Rails: 5.2.4
  • data-confirm-modal: 1.6.3
  • Bootstrap: 4.4

mya-zaki avatar Jul 09 '20 15:07 mya-zaki

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/

tagliala avatar Feb 13 '21 18:02 tagliala

@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

tagliala avatar Feb 14 '21 10:02 tagliala