Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
Popstate event is not firing on mobile after adding touch event listeners

I'm adding a new entry to my browser's history stack with pushState. Now popstate event should fire when pressing the back button, right? And at least on mobile, it requires some kind of user action before pressing the back button to fire (scroll or touch).

This is my current situation and it is working nicely on mobile if I click or scroll a bit before pressing the back button.

Now if I add touchstart, touchmove or touchend event listener then popstate event is firing only if I perform touch first and then press the back button. But it is not firing if I scroll only and do not perform touch.

Below are two snippets of code that explain the situation.

Alert is shown, only small scroll is required before pressing back button:

window.addEventListener('popstate', () => {
    alert('This is test');
});

Alert is not shown, requires click before pressing back button:

window.addEventListener('popstate', () => {
    alert('This is test');
});

document.addEventListener('touchmove', () => {
    // Empty eventListener here
});

Any ideas why it is not working with scroll-only after adding touch event listeners?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda