react / react/react

Form input name='nodeName' breaks onSubmit event handling

Open
#6,284 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: DOM Type: Bug
Dominant language
JavaScript
Stars
251k
Forks
51.4k
Avg merge
2d 4h
Merged PRs (30d)
53

Description

It happened that I stumbled on following edge case. If you add name='nodeName' attribute to form's input, at some point of React event handling (ChangeEventPlugin.js: shouldUseChangeEvent()) it will call: elem.nodeName && elem.nodeName.toLowerCase(), but coincidentally nodeName property refers to input and invocation fails.

Here's a jsFiddle example

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the jsFiddle reproduction and inspect ChangeEventPlugin.js, especially shouldUseChangeEvent(), where the input's nodeName is accessed. Confirm the failure when a form input is named nodeName, then verify that onSubmit and related event handling work without that collision.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.