fix(web): evitar el zoom residual de iOS al cerrar el teclado
iOS (Safari y standalone) auto-zoomea al enfocar un control de formulario con font-size < 16px y, al cerrar el teclado, no restaura el scale: la app quedaba con zoom hasta que el usuario hacía pinch-out o recargaba. - Input sube a 16px en mobile (text-base sm:text-sm), manteniendo los 14px de escritorio. iPad queda fuera porque el zoom-on-focus es exclusivo de iPhone. - El prefijo $ de GroupForm sigue el mismo tamaño para no desalinearse. - Guard en @layer base para textareas/selects/inputs crudos futuros.
This commit is contained in:
@@ -11,7 +11,9 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
<input
|
<input
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
'h-10 w-full rounded-xl border border-border bg-surface px-3 text-sm text-primary placeholder:text-foreground/40 transition-colors focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 disabled:cursor-not-allowed disabled:opacity-50',
|
// text-base (16px) en mobile: iOS auto-zoomea al enfocar controles con
|
||||||
|
// font-size < 16px y, al cerrar el teclado, no restaura el scale.
|
||||||
|
'h-10 w-full rounded-xl border border-border bg-surface px-3 text-base sm:text-sm text-primary placeholder:text-foreground/40 transition-colors focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/30 disabled:cursor-not-allowed disabled:opacity-50',
|
||||||
invalid && 'border-danger focus:border-danger focus:ring-danger/30',
|
invalid && 'border-danger focus:border-danger focus:ring-danger/30',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export function GroupForm({
|
|||||||
<div>
|
<div>
|
||||||
<Label htmlFor="price">Precio</Label>
|
<Label htmlFor="price">Precio</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<span className="pointer-events-none absolute inset-y-0 left-3 flex items-center text-sm text-foreground/50">
|
<span className="pointer-events-none absolute inset-y-0 left-3 flex items-center text-base text-foreground/50 sm:text-sm">
|
||||||
$
|
$
|
||||||
</span>
|
</span>
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -164,4 +164,20 @@
|
|||||||
@apply bg-background text-primary antialiased transition-colors;
|
@apply bg-background text-primary antialiased transition-colors;
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* iOS (Safari y standalone) hace auto-zoom al enfocar un control de
|
||||||
|
formulario con font-size < 16px, y al cerrar el teclado no restaura el
|
||||||
|
scale: la app queda con zoom. El `Input` ya sube a 16px en mobile
|
||||||
|
(`text-base sm:text-sm`); esto es la red de seguridad para textareas,
|
||||||
|
selects o inputs crudos que se agreguen más adelante.
|
||||||
|
El 639px calza con el breakpoint `sm` de Tailwind. El `!important` es
|
||||||
|
a propósito: sin él, una clase `text-sm` en un input futuro ganaría por
|
||||||
|
especificidad y reintroduciría el bug sin avisar. */
|
||||||
|
@media (max-width: 639px) {
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
select {
|
||||||
|
font-size: 16px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user