Skip to content

Commit baf9d3c

Browse files
author
Ravi Singh
committed
fix: iOS Safari keyboard/autofill loop — viewport + layout fixes
Root cause: iOS Safari resizes the visual viewport when autofill bar appears, which triggers layout reflow on fixed/100vh containers, which re-triggers autofill detection, creating an infinite loop. Fixes: - viewport meta: maximum-scale=1, user-scalable=no (prevents zoom) - html/body overflow:hidden, #root handles scrolling (prevents reflow) - Login container uses min-h-[100dvh] instead of fixed positioning - Removed font-size:16px !important hack (viewport meta handles it)
1 parent c0db305 commit baf9d3c

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

pwa/client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
66
<meta name="theme-color" content="#0F172A" />
77
<meta name="apple-mobile-web-app-capable" content="yes" />
88
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

pwa/client/src/index.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ html.light input, html.light select { background: #F8FAFC !important; color: #0F
4444
html, body, #root {
4545
height: 100%;
4646
overscroll-behavior: none;
47+
/* Prevent iOS Safari from resizing layout when keyboard/autofill appears */
48+
overflow: hidden;
4749
}
4850

49-
/* Prevent iOS auto-zoom on input focus (requires 16px minimum) */
50-
input, select, textarea {
51-
font-size: 16px !important;
51+
#root {
52+
overflow: auto;
53+
-webkit-overflow-scrolling: touch;
5254
}
5355

56+
/* iOS viewport zoom prevention is handled by meta viewport tag */
57+
5458
body {
5559
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
5660
-webkit-tap-highlight-color: transparent;

pwa/client/src/pages/Login.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default function Login() {
114114
};
115115

116116
return (
117-
<div className="fixed inset-0 flex flex-col items-center justify-center px-6 bg-slate-950 overflow-auto">
117+
<div className="min-h-[100dvh] flex flex-col items-center justify-center px-6 bg-slate-950">
118118
{/* Logo */}
119119
<div className="mb-10 text-center">
120120
<div className="inline-flex items-center justify-center w-20 h-20 rounded-2xl bg-water/10 mb-4">

0 commit comments

Comments
 (0)