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

149
Vistas
Unable to page refresh when I add window.addEventListener inside the component class

I have issues refreshing the page when I have window.addEventListener snippet in the component class.

componentDidMount() {
    window.addEventListener("keydown" , function(event) {
        event.preventDefault();
        if (event.keyCode === 13) {
            document.getElementById("searchLink").click();
        }
    });
}

Note: ctrl+f5 doesn't work, all keyboard actions fail to work when I have this snippet enabled. even the chrome console is not opening with the keyboard shortcut. Refreshing the page with mouse pointer also doesn't work in the browser.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

componentDidMount() {
    window.addEventListener("keydown" , function(event) {
        if (event.key === "Enter") {
            event.preventDefault();
            document.getElementById("searchLink").click();
        }
    });
}

preventDefault is canceling all keyboard key press

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