Skip to content

Fix inputRef leaking onto <input> DOM element#117

Open
DerekAgility wants to merge 1 commit into
mainfrom
dlo/fix-inputref-dom-leak
Open

Fix inputRef leaking onto <input> DOM element#117
DerekAgility wants to merge 1 commit into
mainfrom
dlo/fix-inputref-dom-leak

Conversation

@DerekAgility
Copy link
Copy Markdown
Contributor

Summary

  • FormInputWithAddons was passing inputRef as a regular prop into InputField. InputField didn't destructure it, so it ended up in ...rest and was spread onto the underlying <input>, producing a React DOM-prop warning (React does not recognize the inputRef prop on a DOM element) for every consumer — even when no inputRef was passed.
  • Fixed by forwarding the ref via ref={inputRef} in FormInputWithAddons (InputField is already a forwardRef), and defensively destructuring inputRef out of props in InputField so a future caller spreading inputRef can't reintroduce the leak.
  • Audited sibling input components (TextInput, TextArea, Select, TextInputSelect, AnimatedFormInputWithAddons) — none of them leak.
  • Added a vitest covering both the warning and the rendered DOM attribute, confirmed it fails on the unfixed code and passes after.

Test plan

  • yarn test --run — all 14 tests across 3 files pass
  • New FormInputWithAddons.test.tsx fails on main and passes on this branch
  • Storybook smoke check: render a story that uses FormInputWithAddons with and without inputRef and confirm the browser console no longer logs the React warning

🤖 Generated with Claude Code

FormInputWithAddons was passing inputRef as a prop into InputField,
which didn't destructure it — so it landed in ...rest and got spread
onto the underlying <input>, triggering a React DOM-prop warning even
when consumers never passed inputRef. Now FormInputWithAddons forwards
the ref via ref={inputRef}, and InputField defensively strips inputRef
from props so the leak can't reoccur.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plenum-ui Ready Ready Preview, Comment May 27, 2026 2:29pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant