Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(ui): normalize iOS input font sizing (#7468)

Andrew Huang3d8349c7a8bd
diff --git a/frontend/.storybook/preview.tsx b/frontend/.storybook/preview.tsx
index 3db5dfc0c6..9ae2d9dbfd 100644
--- a/frontend/.storybook/preview.tsx
+++ b/frontend/.storybook/preview.tsx
@@ -1,11 +1,15 @@
import type { Preview } from "@storybook/react-vite";
+import { initializePlatform } from "../src/lib/fn/platform";
+
import { DocumentDecorator, RouterDecorator } from "./decorators";
import "@fontsource/inter/400.css";
import "@fontsource/inter/500.css";
import "../src/index.css";
+initializePlatform();
+
const preview: Preview = {
decorators: [DocumentDecorator, RouterDecorator],
parameters: {
diff --git a/frontend/src/components/v3/generic/Input/Input.tsx b/frontend/src/components/v3/generic/Input/Input.tsx
index 8de7e3d690..6948d920b2 100644
--- a/frontend/src/components/v3/generic/Input/Input.tsx
+++ b/frontend/src/components/v3/generic/Input/Input.tsx
@@ -10,7 +10,7 @@ const Input = forwardRef<HTMLInputElement, React.ComponentProps<"input"> & { isE
type={type}
data-slot="input"
className={cn(
- "h-9 w-full min-w-0 rounded-md border border-border bg-transparent px-3 py-1 text-base text-foreground shadow-xs outline-1 outline-offset-4 outline-transparent transition-colors outline-solid file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ "h-9 w-full min-w-0 rounded-md border border-border bg-transparent px-3 py-1 text-sm text-foreground shadow-xs outline-1 outline-offset-4 outline-transparent transition-colors outline-solid file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
"hover:border-foreground/20 focus-visible:border-accent focus-visible:outline-accent/60",
"aria-invalid:border-danger aria-invalid:focus-visible:outline-danger/60",
"selection:bg-foreground selection:text-background",
diff --git a/frontend/src/components/v3/generic/TextArea/TextArea.tsx b/frontend/src/components/v3/generic/TextArea/TextArea.tsx
index e8167a9a32..84b6000a33 100644
--- a/frontend/src/components/v3/generic/TextArea/TextArea.tsx
+++ b/frontend/src/components/v3/generic/TextArea/TextArea.tsx
@@ -12,7 +12,7 @@ const TextArea = React.forwardRef<
ref={ref}
data-slot="textarea"
className={cn(
- "placeholder:text-muted-foreground flex min-h-16 thin-scrollbar w-full rounded-md border border-border bg-transparent px-3 py-2 text-base text-foreground shadow-xs outline-1 outline-offset-4 outline-transparent transition-colors outline-solid hover:border-foreground/20 focus-visible:border-accent focus-visible:outline-accent/60 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger aria-invalid:focus-visible:outline-danger/60 md:text-sm",
+ "placeholder:text-muted-foreground flex min-h-16 thin-scrollbar w-full rounded-md border border-border bg-transparent px-3 py-2 text-sm text-foreground shadow-xs outline-1 outline-offset-4 outline-transparent transition-colors outline-solid hover:border-foreground/20 focus-visible:border-accent focus-visible:outline-accent/60 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger aria-invalid:focus-visible:outline-danger/60",
className
)}
aria-invalid={isError}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 127edde5cc..e0f315c83a 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -66,6 +66,9 @@
--breakpoint-dashboard: 1400px;
/* Fonts */
+ --text-xs: 0.75rem;
+ --text-sm: 0.875rem;
+ --text-base: 1rem;
--font-alliance:
"Alliance No. 2", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
sans-serif;
@@ -232,6 +235,15 @@
--color-blue-900: #00367d;
}
+/* iOS Safari zooms the viewport when focusing an input whose font-size is below 16px.
+ Bumping the type scale on detected iOS devices keeps form controls at/above that
+ threshold to prevent the zoom while preserving their relationship to surrounding text. */
+html[data-platform="ios"] {
+ --text-xs: 0.875rem;
+ --text-sm: 1rem;
+ --text-base: 1.125rem;
+}
+
@utility min-table-row {
width: 1%;
white-space: nowrap;
diff --git a/frontend/src/lib/fn/platform.ts b/frontend/src/lib/fn/platform.ts
new file mode 100644
index 0000000000..885960cad7
--- /dev/null
+++ b/frontend/src/lib/fn/platform.ts
@@ -0,0 +1,9 @@
+export const initializePlatform = () => {
+ const isIos =
+ /iPad|iPhone|iPod/.test(navigator?.userAgent ?? "") ||
+ (!!navigator?.userAgent?.includes("Macintosh") && (navigator?.maxTouchPoints ?? 0) > 1);
+
+ if (isIos) {
+ document.documentElement.dataset.platform = "ios";
+ }
+};
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
index 658cca56d8..9349ec884c 100644
--- a/frontend/src/main.tsx
+++ b/frontend/src/main.tsx
@@ -7,6 +7,7 @@ import NProgress from "nprogress";
import { Lottie } from "./components/v2";
import { queryClient } from "./hooks/api/reactQuery";
+import { initializePlatform } from "./lib/fn/platform";
import { ErrorPage } from "./pages/public/ErrorPage/ErrorPage";
import { NotFoundPage } from "./pages/public/NotFoundPage/NotFoundPage";
// Import the generated route tree
@@ -27,6 +28,8 @@ import "./translation";
// have a look at the Quick start guide
// for passing in lng and translations on init/
+initializePlatform();
+
// Configure Lottie player to use local WASM file
setWasmUrl(lottieWasmUrl);