问题
I've tried to add a sweetalert component over bootstrap's modal, the problem was that the modal has an atribute 'tabindex' and the focus property was not working as expected, I found a solution that i want to complement, I removed the 'tabindex' attribute and then set focus on the button that I wanted.
If you have another solution, i'd like to know it!
sweet.fire({
position: 'top',
title: 'ARE YOU SURE TO UPDATE THIS ITEM?',
type: 'info',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Continuar',
cancelButtonText: 'Cancelar',
reverseButtons: true,
allowOutsideClick:false,
onOpen:() => {
document.getElementById("modal_categoria_form").removeAttribute('tabindex');
sweet.getConfirmButton().focus();
}
})
来源:https://stackoverflow.com/questions/58806448/show-sweetalert2-over-bootstrap-modal