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(