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

131
Visualizações
mouseleave event on html tag getting triggered on scrolling the page

I have added mouseleave event on the current page HTML tag inside useEffect(didMount) of my react application and the expected behavior is that the event should be triggered when the cursor leaves the window. But the event is sometimes getting triggered when the user is normally scrolling through the page.

Here's the code snipped which I have added.

const pageHtml = document.getElementsByTagName('html')[0];
const mouseLeaveHandler = () => {
  console.log('Left::');
};

pageHtml.addEventListener('mouseleave', mouseLeaveHandler);

I just want to show a popup only when the mouse pointer leaves the current browser window. So, any help related to this would be appreciated.

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