Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

56
Vistas
How to not try to trigger disabled buttons on pressing enter by default

I have a react app, and when I was pressing enter it was triggering a hidden button, rather than the button that was showed. So I set it to disabled if hidden.

But the problem now is that "on enter" nothing happens when that button is disabled. I imagine the default behaviour is to still try to trigger the closest button on the page (regardless of if it's disabled or not).

Is there a way to alter this behaviour, or a different attribute (other than / side by side) the disabled attribute.

I know this can be done instead:

How to trigger a button click on Enter in React

But I would prefer a cleaner way to monitoring which button should be triggered on enter at a specific time

7 months ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos