From 1abadd04b8513ed852388a26b5b957f60076fe0e Mon Sep 17 00:00:00 2001 From: Zhengen TANG Date: Fri, 7 Aug 2026 14:49:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=96=B0=E5=A2=9E=E8=9C=9C?= =?UTF-8?q?=E7=BD=90=E5=8F=8D=E5=9E=83=E5=9C=BE=E5=AD=97=E6=AE=B5=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20CookieConsent=20=E7=9A=84=20react-hooks/se?= =?UTF-8?q?t-state-in-effect=20lint=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blocks/form/LeadForm.tsx | 13 +++++++++++++ components/layout/CookieConsent.tsx | 2 ++ 2 files changed, 15 insertions(+) diff --git a/blocks/form/LeadForm.tsx b/blocks/form/LeadForm.tsx index 551630b..4653a24 100644 --- a/blocks/form/LeadForm.tsx +++ b/blocks/form/LeadForm.tsx @@ -8,6 +8,7 @@ const API_BASE_URL = export default function LeadForm({ value }: { value: FormBlockValue }) { const [values, setValues] = useState>({}); + const [website, setWebsite] = useState(""); // 蜂蜜陷阱字段,正常用户不可见,只有机器人会填写 const [status, setStatus] = useState<"idle" | "submitting" | "done" | "error">( "idle", ); @@ -28,6 +29,7 @@ export default function LeadForm({ value }: { value: FormBlockValue }) { form_id: form!.id, data: values, source_url: typeof window !== "undefined" ? window.location.href : "", + website, }), }); if (!res.ok) throw new Error("submit failed"); @@ -93,6 +95,17 @@ export default function LeadForm({ value }: { value: FormBlockValue }) { )} ))} + {/* 蜂蜜陷阱字段:离屏幕定位而非 display:none,避免部分机器人检测到隐藏属性后跳过;无需 tabIndex/aria-hidden 以外的额外依赖 */} + setWebsite(e.target.value)} + autoComplete="off" + tabIndex={-1} + aria-hidden="true" + className="absolute left-[-9999px] top-auto h-px w-px overflow-hidden" + />