generated from react-component/footer
-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Bug Description
The hidden textarea created for auto-size height calculation is keyboard-focusable due to using the invalid HTML attribute tab-index (with hyphen) instead of the valid tabindex (without hyphen).
Since tab-index is not a recognized HTML attribute, the browser ignores it, leaving the hidden textarea in the tab order.
Docs on tabindex: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex
Steps to Reproduce
- Render any
<TextArea autoSize />component - Tab through the page using keyboard navigation
- Observe that focus lands on an invisible textarea element
Expected Behavior
The hidden textarea should not be keyboard-focusable.
Actual Behavior
Users can tab to an invisible <textarea name="hiddenTextarea"> element, causing confusion for keyboard and screen reader users.
Root Cause
In src/calculateNodeHeight.tsx, line 102:
// Current (invalid HTML attribute)
hiddenTextarea.setAttribute('tab-index', '-1');
// Should be (valid HTML attribute)
hiddenTextarea.setAttribute('tabindex', '-1');Impact
- Accessibility: Screen reader users and keyboard navigators encounter an invisible, non-interactive element
- User Experience: Unexpected "stop" when tabbing through form fields
Bug Origin
- Introduced in: v0.2.0 (June 10, 2020)
- Commit:
fee4e45 - Age: ~5.5 years
Proposed Fix
I have a PR ready with:
- One-character fix:
tab-index→tabindex - Tests to verify hidden textarea has correct
tabindex="-1"attribute
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels