Next.js Discord

Discord Forum

Preventing Screen Zoom on iOS When Focusing Input Fields

Unanswered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Open in Discord
Original message was deleted.

6 Replies

Harrier
@Schneider’s Smooth-fronted Caiman I have the same issue too, have you been able to find a solution?


my problem looks like this
Try on focus e.preventdefault
@Schneider’s Smooth-fronted Caiman
OnFocus((e)=> e.preventdefault())
Harrier
Hello for all that are trying to fix this problem


i have used the advice listed on the web to adjust to 16px on css

.input, textarea, select {
  font-size: 16px;
}



But that doesnt work


eventually i changed my entire component,

especially the input component from shadcn to 16px


and that solved the problem


import * as React from "react"
import { cn } from "@/lib/utils"

const Input = React.forwardRef(({ className, type, ...props }, ref) => {
  return (
    <input
      type={type}
      className={cn(
        "flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-800 dark:bg-slate-950 dark:ring-offset-slate-950 dark:placeholder:text-slate-400 dark:focus-visible:ring-slate-300",
        className
      )}
      ref={ref}
      style={{ fontSize: '16px' }} // Set font size to 16px
      {...props}
    />
  );
})
Input.displayName = "Input"

export { Input }