Skip to content

Commit

Permalink
Make sure that select has multiple attribute set to appropriate s…
Browse files Browse the repository at this point in the history
…tate before appending options

fixes facebook#13222
  • Loading branch information
segoddnja committed Jul 25, 2018
1 parent 0154a79 commit 2abb232
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/react-dom/src/client/ReactDOMFiberComponent.js
Expand Up @@ -378,6 +378,12 @@ export function createElement(
// See discussion in https://github.com/facebook/react/pull/6896
// and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
domElement = ownerDocument.createElement(type);
// Make sure that `select` has `multiple` attribute set to appropriate state before appending options
// To prevent first option be initialy made selected
// see more details in https://github.com/facebook/react/issues/13222
if (type === 'select' && !!props.multiple) {
domElement.setAttribute('multiple', 'true');
}
}
} else {
domElement = ownerDocument.createElementNS(namespaceURI, type);
Expand Down

0 comments on commit 2abb232

Please sign in to comment.