From 8f32d129101ff3662e58823444116cd64e0aa4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B3=E5=BB=B7=E5=AE=89?= <73953029+nrps9909@users.noreply.github.com> Date: Thu, 27 Aug 2026 11:55:50 +0800 Subject: [PATCH] fix: keep measurement textarea out of tab order --- src/calculateNodeHeight.tsx | 2 +- tests/TextArea.test.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/calculateNodeHeight.tsx b/src/calculateNodeHeight.tsx index e16c9fd..de63d39 100644 --- a/src/calculateNodeHeight.tsx +++ b/src/calculateNodeHeight.tsx @@ -99,7 +99,7 @@ export default function calculateAutoSizeStyle( ): React.CSSProperties { if (!hiddenTextarea) { hiddenTextarea = document.createElement('textarea'); - hiddenTextarea.setAttribute('tab-index', '-1'); + hiddenTextarea.setAttribute('tabindex', '-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. diff --git a/tests/TextArea.test.tsx b/tests/TextArea.test.tsx index 390f1cd..3f79b1d 100644 --- a/tests/TextArea.test.tsx +++ b/tests/TextArea.test.tsx @@ -96,6 +96,17 @@ describe('TextArea', () => { expect(textarea.value).toBe('222'); }); + it('keeps the hidden measurement textarea out of the tab order', async () => { + render(