Skip to content

Commit

Permalink
fix: Fixing Alert and Error radio button examples (#2197)
Browse files Browse the repository at this point in the history
Fixes: #2196  

The examples for the Alert and Error radio groups were not accessible to the keyboard because the disabled property was set on an already pre-selected input. This was a good example of something not to do!

[category:Components]
  • Loading branch information
williamjstanton committed May 25, 2023
1 parent 203dc9c commit b6c4813
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/react/radio/stories/Radio.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Radio Group should be used in tandem with [Form Field](/components/inputs/form-f

### Disabled

Set the `disabled` prop of the Radio Button to prevent users from interacting with it.
Set the `disabled` prop of the Radio Button to prevent users from interacting with it. Be careful not to disable a pre-selected Radio Button, this will block keyboard access from the entire Radio Group.

<ExampleCodeBlock code={Disabled} />

Expand Down
4 changes: 2 additions & 2 deletions modules/react/radio/stories/examples/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const Alert = () => {
<FormField
error={FormField.ErrorType.Alert}
hintId="hint-alert"
hintText="Deep Dish is no longer available. Please select a different crust."
hintText="Deep dish is an extra $2.99"
label="Choose Your Pizza Crust"
useFieldset={true}
>
<RadioGroup name={useUniqueId()} onChange={handleChange} value={value}>
<Radio disabled={true} label="Deep dish (sold out)" value="deep-dish" />
<Radio label="Deep dish" value="deep-dish" />
<Radio label="Thin" value="thin" />
<Radio label="Gluten free" value="gluten-free" />
<Radio label="Cauliflower" value="cauliflower" />
Expand Down
4 changes: 2 additions & 2 deletions modules/react/radio/stories/examples/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const Error = () => {
<FormField
error={FormField.ErrorType.Error}
hintId="hint-error"
hintText="Deep Dish is no longer available. Please select a different crust."
hintText="Deep Dish is currently sold out."
label="Choose Your Pizza Crust"
useFieldset={true}
>
<RadioGroup name={useUniqueId()} onChange={handleChange} value={value}>
<Radio disabled={true} label="Deep dish (sold out)" value="deep-dish" />
<Radio label="Deep dish" value="deep-dish" />
<Radio label="Thin" value="thin" />
<Radio label="Gluten free" value="gluten-free" />
<Radio label="Cauliflower" value="cauliflower" />
Expand Down

0 comments on commit b6c4813

Please sign in to comment.