Skip to content

Commit 93493cf

Browse files
maartenthn1k0
authored andcommitted
Temporary fix for rjsf-team#349 and facebook/react#7630 radio widget bug (rjsf-team#423)
1 parent a3f3e9d commit 93493cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/widgets/RadioWidget.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ function RadioWidget({
1313
// Generating a unique field name to identify this set of radio buttons
1414
const name = Math.random().toString();
1515
const {enumOptions, inline} = options;
16+
// checked={checked} has been moved above name={name}, As mentioned in #349;
17+
// this is a temporary fix for radio button rendering bug in React, facebook/react#7630.
1618
return (
1719
<div className="field-radio-group">{
1820
enumOptions.map((option, i) => {
@@ -21,9 +23,9 @@ function RadioWidget({
2123
const radio = (
2224
<span>
2325
<input type="radio"
26+
checked={checked}
2427
name={name}
2528
value={option.value}
26-
checked={checked}
2729
disabled={disabled}
2830
autoFocus={autofocus && i === 0}
2931
onChange={_ => onChange(option.value)}/>

0 commit comments

Comments
 (0)