mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
cherry pick radio input fix
This commit is contained in:
@@ -13,7 +13,7 @@ var DOMPropertyOperations = require('DOMPropertyOperations');
|
||||
var LinkedValueUtils = require('LinkedValueUtils');
|
||||
var ReactDOMComponentTree = require('ReactDOMComponentTree');
|
||||
var ReactUpdates = require('ReactUpdates');
|
||||
|
||||
var inputValueTracking = require('inputValueTracking');
|
||||
var invariant = require('invariant');
|
||||
var warning = require('warning');
|
||||
|
||||
@@ -348,6 +348,11 @@ function _handleChange(event) {
|
||||
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
|
||||
'same `name` is not supported.',
|
||||
);
|
||||
|
||||
// We need update the tracked value on the named cousin since the value
|
||||
// was changed but the input saw no event or value set
|
||||
inputValueTracking.updateValueIfChanged(otherNode);
|
||||
|
||||
// If this is a controlled radio button group, forcing the input that
|
||||
// was previously checked to update will cause it to be come re-checked
|
||||
// as appropriate.
|
||||
|
||||
@@ -907,10 +907,6 @@ ReactDOMComponent.Mixin = {
|
||||
// happen after `_updateDOMProperties`. Otherwise HTML5 input validations
|
||||
// raise warnings and prevent the new value from being assigned.
|
||||
ReactDOMInput.updateWrapper(this);
|
||||
|
||||
// We also check that we haven't missed a value update, such as a
|
||||
// Radio group shifting the checked value to another named radio input.
|
||||
inputValueTracking.updateValueIfChanged(this);
|
||||
break;
|
||||
case 'textarea':
|
||||
ReactDOMTextarea.updateWrapper(this);
|
||||
|
||||
Reference in New Issue
Block a user