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

98
Vistas
Stop scrolling window element on keypress

I got a custom dropdown element and enabled scrolling on keypress, using tabindex="-1" on the elements combined with focusing the elements:

document.getElementsByClassName(`elem-${hasFocus.value}`)[0].focus();

Problem occurs when the keypress-scroll hits the top/bottom border. Then pressing the keys scrolls the window. The standard behavior is stopped by using evt.preventDefault(). But this also stops the "smooth" scroll behavior using tabindex (It keeps scrolling but just jumps to the list items). Is there a different way preventing the standard window scroll behavior?

I got no reproducable example but a git repo: Dropdown component

The important method is arrowNavigation.

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

0

Didn't understood well, but if what you want is to stop the event propagation to the window when using evt.preventDefault() in your handler, you can try evt.stopPropagation()

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