Skip to content

Commit

Permalink
fix(#5747): [react-aira: RadioGroup]: No tabindex/Can't keyboard focu…
Browse files Browse the repository at this point in the history
…s to input until value is checked (#5755)

Looks like the default selected value in the example is an empty string, which is not the same as null. https://github.com/adobe/react-spectrum/pull/4985/files#diff-26ddea7c3bd0c2b48179af98635706a6391a01b59c936e8b497d1843a97ff202R71-R78

A more robust solution might be to validate whether the default value is one of the possible values within the radio group, but that's a bit more complicated.

Co-authored-by: Robert Snow <rsnow@adobe.com>
Co-authored-by: Daniel Lu <dl1644@gmail.com>
  • Loading branch information
3 people committed Jan 29, 2024
1 parent 87dbb74 commit b5974ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-aria-components/docs/RadioGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ The `onChange` event is fired when the user selects a radio.

```tsx example
function Example() {
let [selected, setSelected] = React.useState('');
let [selected, setSelected] = React.useState(null);

return (
<>
<MyRadioGroup label="Favorite avatar" value={selected} onChange={setSelected}>
<Radio value="wizard">Wizard</Radio>
<Radio value="dragon">Dragon</Radio>
</MyRadioGroup>
<p>You have selected: {selected}</p>
<p>You have selected: {selected ?? ''}</p>
</>
);
}
Expand Down

1 comment on commit b5974ad

@rspbot
Copy link

@rspbot rspbot commented on b5974ad Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.