fix(webui): keep Safari forms and overlays from zooming or locking

Focus stays at 16px, a modal locks the visual viewport, and motion
that WebKit clips or flashes is dropped.
This commit is contained in:
DrSmoothl committed 2026-09-19 16:30:11 +08:00
1 parent 87e964ab95
commit 1ab14ea306
9 files changed
+118 -53

No files matched your search

@@ -204,7 +204,7 @@ export function NotificationChannelDialog(props: NotificationChannelDialogProps)
: '账号上线 / 下线时向该 Webhook POST 一条渲染后的通知。'}
closeLabel="关闭渠道编辑弹窗"
maxWidth={576}
maxHeight="min(86vh, 780px)"
maxHeight="min(86dvh, 780px)"
footer={(
<>
<Button variant="outline" onClick={() => onOpenChange(false)}>
@@ -2,23 +2,33 @@ import { useMemo } from 'react';
import { encode } from 'uqr';
export function TotpQr({ value, label }: { value: string; label: string }) {
const qr = useMemo(() => encode(value, { ecc: 'M', border: 2 }), [value]);
const modules = qr.data.flatMap((row, y) => (
row.flatMap((on, x) => (
on ? <rect key={`${x}-${y}`} x={x} y={y} width="1" height="1" /> : []
))
));
const qr = useMemo(() => encode(value, { ecc: 'M', border: 4 }), [value]);
const modulePx = 4;
const px = qr.size * modulePx;
const d = useMemo(() => {
const parts: string[] = [];
qr.data.forEach((row, y) => {
row.forEach((on, x) => {
if (on) parts.push(`M${x * modulePx},${y * modulePx}h${modulePx}v${modulePx}h-${modulePx}z`);
});
});
return parts.join('');
}, [qr]);
return (
<svg
role="img"
aria-label={label}
viewBox={`0 0 ${qr.size} ${qr.size}`}
className="size-44 rounded-lg bg-white text-black"
shapeRendering="crispEdges"
>
<rect width={qr.size} height={qr.size} fill="white" />
<g fill="black">{modules}</g>
</svg>
<div className="rounded-lg bg-white p-2">
<svg
role="img"
aria-label={label}
width={px}
height={px}
viewBox={`0 0 ${px} ${px}`}
className="block text-black"
shapeRendering="crispEdges"
>
<rect width={px} height={px} fill="white" />
<path d={d} fill="black" />
</svg>
</div>
);
}