diff --git a/apps/web/src/components/chat/ComposerSecretRequestPanel.tsx b/apps/web/src/components/chat/ComposerSecretRequestPanel.tsx index 6ad540106..1cc593d88 100644 --- a/apps/web/src/components/chat/ComposerSecretRequestPanel.tsx +++ b/apps/web/src/components/chat/ComposerSecretRequestPanel.tsx @@ -22,7 +22,7 @@ import { selectEnvironmentState, useStore } from "~/store"; import { formatTimeWithDay } from "~/timestampFormat"; import { useComputerLabel } from "../sidebar/linkedComputers"; import { Button } from "../ui/button"; -import { Input } from "../ui/input"; +import { Input, MASKED_TEXT_FONT } from "../ui/input"; import { Textarea } from "../ui/textarea"; import { toastManager } from "../ui/toast"; import { settingsChangeDeviceLabel } from "./settingsChangeCard.logic"; @@ -38,14 +38,6 @@ import { type SecretAnswerResult, } from "./secretRequestClaims"; -/** - * The masking dot sits at a different height in every font (SF Mono high, - * the system font low), and themes can change the fonts. Masked text is - * pinned to the app's bundled sans, whose dot is centered in the field; - * shown text reads in mono. - */ -const MASKED_FONT = "[font-family:'Schibsted_Grotesk_Variable',var(--font-sans)]"; - function showNotice(notice: SecretRequestNotice): void { toastManager.add({ type: notice.type, @@ -264,7 +256,8 @@ export const ComposerSecretRequestPanel = memo(function ComposerSecretRequestPan autoComplete="off" // Masked like a password field until shown. className={cn( - shown ? "font-mono" : MASKED_FONT, + // Shown text reads in mono; masked dots sit centered (see MASKED_TEXT_FONT). + shown ? "font-mono" : MASKED_TEXT_FONT, !shown && "[&_textarea]:[-webkit-text-security:disc]", )} onChange={(event) => onFieldChange(event.target.value)} @@ -276,7 +269,7 @@ export const ComposerSecretRequestPanel = memo(function ComposerSecretRequestPan size="sm" type={shown ? "text" : "password"} autoComplete="new-password" - className={shown ? "font-mono" : MASKED_FONT} + className="font-mono" onChange={(event) => onFieldChange(event.target.value)} onKeyDown={onFieldKeyDown} onPaste={onFieldPaste} diff --git a/apps/web/src/components/scheduled/EventTaskPanels.tsx b/apps/web/src/components/scheduled/EventTaskPanels.tsx index ffa809e55..8048e6858 100644 --- a/apps/web/src/components/scheduled/EventTaskPanels.tsx +++ b/apps/web/src/components/scheduled/EventTaskPanels.tsx @@ -293,7 +293,7 @@ function SigningSecretRow({ size="sm" type="password" autoComplete="off" - className="w-full min-w-0 font-mono sm:w-64" + className="w-full min-w-0 sm:w-64" value={typing} placeholder="The sender's secret" aria-label="Signing secret" diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx index f7e077696..2fe56ce46 100644 --- a/apps/web/src/components/ui/input.tsx +++ b/apps/web/src/components/ui/input.tsx @@ -5,6 +5,14 @@ import type * as React from "react"; import { cn } from "~/lib/utils"; +/** + * The masking dot sits at a different height in every font (SF Mono high, + * the system font low), and themes can change the fonts. Masked text is + * pinned to the app's bundled sans, whose dot is centered in the field. + * Password inputs get it here; a masked textarea adds it itself. + */ +export const MASKED_TEXT_FONT = "[font-family:'Schibsted_Grotesk_Variable',var(--font-sans)]"; + type InputProps = Omit, "size"> & { size?: "sm" | "default" | "lg" | number; unstyled?: boolean; @@ -24,6 +32,7 @@ function Input({ size === "lg" && "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5", props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none", + props.type === "password" && MASKED_TEXT_FONT, props.type === "file" && "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm", );