From a2f6e74a20df12c76365dbbd6e2196f1254efc6b Mon Sep 17 00:00:00 2001 From: zhe-he Date: Wed, 3 Jul 2024 15:11:36 +0800 Subject: [PATCH] update(hiddenTextarea): add name --- src/calculateNodeHeight.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calculateNodeHeight.tsx b/src/calculateNodeHeight.tsx index f1424cf..7e443a4 100644 --- a/src/calculateNodeHeight.tsx +++ b/src/calculateNodeHeight.tsx @@ -101,6 +101,10 @@ export default function calculateAutoSizeStyle( hiddenTextarea = document.createElement('textarea'); hiddenTextarea.setAttribute('tab-index', '-1'); hiddenTextarea.setAttribute('aria-hidden', 'true'); + // fix: A form field element should have an id or name attribute + // A form field element has neither an id nor a name attribute. This might prevent the browser from correctly autofilling the form. + // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea + hiddenTextarea.setAttribute('name', 'hiddenTextarea'); document.body.appendChild(hiddenTextarea); }