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

232
Vistas
React: trigger a zoom out after a zoom in caused by input focus

There is a way to zoom out a page in React after the page was zoomed-in because an <input> got focused? Imagine a simple component like the following: I'd like to zoom out on form submit.

const Component = (props) =>{

 const handleSubmit = (e) => {
   e.preventDefault();
   //Zoom out
 }

 return(
   <form onSubmit={handleSubmit}>
      <input/>
      <button>Sign in</button>
   </form>
 );
}

Important:

I do NOT want to disable the zoom-in effect. I found that by setting viewport maximum-scale=1 or by setting font-size to 16px I can disable it [Link here], but that's not the behaviour I want for my page.

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

0

You could trigger this inside your handleSubmit() method to reset the zoom to 100%:

window.document.body.style.zoom = 1;

Note that this will not work in Firefox according to caniuse: https://caniuse.com/css-zoom

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