Skip to content

Commit f573fcc

Browse files
author
Ravi Singh
committed
fix: iOS autofill/keyboard conflict on login form
- Add autoComplete hints so iOS treats login vs register correctly - username/current-password for login, email/new-password for register - one-time-code for OTP input (triggers iOS code autofill from SMS/email) - form autoComplete=off in verify mode to prevent password bar - Removed autoFocus on OTP (was causing focus fights with iOS keyboard)
1 parent d8fdee6 commit f573fcc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pwa/client/src/pages/Login.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default function Login() {
140140

141141
{/* Form card */}
142142
<div className="w-full max-w-sm">
143-
<form onSubmit={handleSubmit} className="space-y-4">
143+
<form onSubmit={handleSubmit} className="space-y-4" autoComplete={mode === 'verify' ? 'off' : 'on'}>
144144
{mode === 'verify' ? (
145145
<>
146146
<p className="text-sm text-slate-400 text-center">
@@ -153,7 +153,7 @@ export default function Login() {
153153
value={code}
154154
onChange={e => setCode(e.target.value.replace(/\D/g, ''))}
155155
required
156-
autoFocus
156+
autoComplete="one-time-code"
157157
className="w-full px-4 py-4 rounded-xl bg-surface border border-slate-700 text-white text-center
158158
text-2xl tracking-[0.5em] font-mono focus:border-water focus:ring-1 focus:ring-water/50 outline-none transition-all"
159159
placeholder="000000"
@@ -165,6 +165,7 @@ export default function Login() {
165165
<div>
166166
<label className="block text-sm font-medium text-slate-300 mb-1.5">Name</label>
167167
<input type="text" value={name} onChange={e => setName(e.target.value)}
168+
autoComplete="name"
168169
className="w-full px-4 py-3 rounded-xl bg-surface border border-slate-700 text-white
169170
focus:border-water focus:ring-1 focus:ring-water/50 outline-none transition-all"
170171
placeholder="Your name" />
@@ -173,13 +174,15 @@ export default function Login() {
173174
<div>
174175
<label className="block text-sm font-medium text-slate-300 mb-1.5">Email</label>
175176
<input type="email" value={email} onChange={e => setEmail(e.target.value)} required
177+
autoComplete={mode === 'register' ? 'email' : 'username'}
176178
className="w-full px-4 py-3 rounded-xl bg-surface border border-slate-700 text-white
177179
focus:border-water focus:ring-1 focus:ring-water/50 outline-none transition-all"
178180
placeholder="you@example.com" />
179181
</div>
180182
<div>
181183
<label className="block text-sm font-medium text-slate-300 mb-1.5">Password</label>
182184
<input type="password" value={password} onChange={e => setPassword(e.target.value)} required minLength={6}
185+
autoComplete={mode === 'register' ? 'new-password' : 'current-password'}
183186
className="w-full px-4 py-3 rounded-xl bg-surface border border-slate-700 text-white
184187
focus:border-water focus:ring-1 focus:ring-water/50 outline-none transition-all"
185188
placeholder="At least 6 characters" />

0 commit comments

Comments
 (0)