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

130
Visualizações
Javascript window.confirm doesn't work if focus isn't on tab?

My code is extremely simple:

const response = confirm("Message");
console.log('done');

Edit: it turns out it has nothing to do with dev tools - it's whether my focus is on that tab or on a different one.


If I have the dev tools closed, the confirm modal simply does not appear and it skips straight to printing done. I have the dev tools open, the confirm modal appears.

I am kinda lost on this one, am I missing something here? If I just write setTimeout(() => { confirm() }, 3000) in the dev tools of a random tab and then close the dev tools, then the confirm still appears there. But with the actual code running on my page...nothing.

Edit - it may be that it only appears if my focus is on the page in question? Is there a rule around that?

about 4 years ago · Juan Pablo Isaza
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