Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
Why don't arrow keys work with Sweetalert2?

I made an alert box using Sweetalert2, however the arrow keys do not work. I want to be able to use the arrow keys to choose between yes and no. It works on the site using their demos, but not with my code. Here is the snippet:

    Swal.fire({
    width: '32rem',
  title: ' Incoming Call!',
  text: "Take it?",
  showCancelButton: true,
  confirmButtonColor: '#3085d6',
  cancelButtonColor: '#d33',
  confirmButtonText: 'Yes',
  cancelButtonText: 'No'
}).then((result) => {
  if (result.isConfirmed) {
      
  }
})
<!DOCTYPE html>
<html>
 <head>
    <meta charset="utf-8">
    <!-- <meta name="viewport" content="width=1980, height=1080"> -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Title</title>
    
    <script
  src="https://code.jquery.com/jquery-3.6.0.min.js"
  integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.0/dist/sweetalert2.all.min.js"></script>
    

Fixed it : Changed the CancelButton to DenyButton. For some weird reason it works with Deny button but not with the cancel button.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This was actually a bug in the library and I fixed it in the latest release: https://github.com/sweetalert2/sweetalert2/releases/tag/v11.4.2

Please update your dependency and arrow keys will work properly with Confirm and Cancel buttons.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda