dillon1000/react

Commit

[Fiber] Update input.defaultValue for type=number too (#36980)

We used to avoid updating .defaultValue until blur on number inputs
because of a Chrome bug, but the relevant Chromium behavior was fixed in
2020 in M85 https://issues.chromium.org/issues/40124871 and likewise in
WebKit https://bugs.webkit.org/show_bug.cgi?id=217156 so I think we can
probably just remove this special-cased logic.

We do still need some special logic for number inputs because it's the
only type where we let users specify a non-string value that has
multiple string representations and need to be careful not to clobber
the .value if it has a slightly different string than what you'd get
from casting a number to string.

Fixes #29862.

Tested with the number inputs fixture in current Chrome, Safari, and
Firefox.
Browse files
Changed paths3 files
First-parent comparison
M packages/react-dom-bindings/src/client/ReactDOMInput.js ModifiedM packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js ModifiedM packages/react-dom/src/__tests__/ReactDOMInput-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…