Pessoal,
Alguém já teve a demanda de fechar o modal com a tecla ESC? Fiz alguns testes, mas sem sucesso.
Pessoal,
Alguém já teve a demanda de fechar o modal com a tecla ESC? Fiz alguns testes, mas sem sucesso.
Olá,
Supondo que vc tenha um modal igual o exemplo do style-guide (TOTVS Fluig Developer), tente o seguinte:
this.myModal = FLUIGC.modal({
title: 'Title',
content: 'Modal Content',
id: 'fluig-modal',
actions: [{
'label': 'Save',
'bind': 'data-open-modal',
},{
'label': 'Close',
'autoClose': true
}]
}, (err, data) => {
if(err) {
console.error(err);
} else {
$('#fluig-modal').keyup(event => {
if (event.key == 'Escape') {
this.myModal.remove();
}
})
}
});
Funcionou, obrigada!