Skip to content

Commit

Permalink
Replace accessibilityLabel by label on RadioGroup (#25128)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegohaz authored Sep 8, 2020
1 parent 5eed5c5 commit 54db7e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/radio-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { useState } from '@wordpress/element';
const MyControlledRadioRadioGroup = () => {
const [ checked, setChecked ] = useState( '25' );
return (
<RadioGroup accessibilityLabel="Width" onChange={ setChecked } checked={ checked }>
<RadioGroup label="Width" onChange={ setChecked } checked={ checked }>
<Radio value="25">25%</Radio>
<Radio value="50">50%</Radio>
<Radio value="75">75%</Radio>
Expand All @@ -71,7 +71,7 @@ import { useState } from '@wordpress/element';

const MyUncontrolledRadioRadioGroup = () => {
return (
<RadioGroup accessibilityLabel="Width" defaultChecked="25">
<RadioGroup label="Width" defaultChecked="25">
<Radio value="25">25%</Radio>
<Radio value="50">50%</Radio>
<Radio value="75">75%</Radio>
Expand Down
11 changes: 2 additions & 9 deletions packages/components/src/radio-group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ import ButtonGroup from '../button-group';
import RadioContext from '../radio-context';

function RadioGroup(
{
accessibilityLabel,
checked,
defaultChecked,
disabled,
onChange,
...props
},
{ label, checked, defaultChecked, disabled, onChange, ...props },
ref
) {
const radioState = useRadioState( {
Expand All @@ -42,7 +35,7 @@ function RadioGroup(
<ReakitRadioGroup
ref={ ref }
as={ ButtonGroup }
aria-label={ accessibilityLabel }
aria-label={ label }
{ ...radioState }
{ ...props }
/>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/radio-group/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const _default = () => {
<RadioGroup
// id is required for server side rendering
id="default-radiogroup"
accessibilityLabel="options"
label="options"
defaultChecked="option2"
>
<Radio value="option1">Option 1</Radio>
Expand All @@ -35,7 +35,7 @@ export const disabled = () => {
// id is required for server side rendering
id="disabled-radiogroup"
disabled
accessibilityLabel="options"
label="options"
defaultChecked="option2"
>
<Radio value="option1">Option 1</Radio>
Expand All @@ -54,7 +54,7 @@ const ControlledRadioGroupWithState = () => {
<RadioGroup
// id is required for server side rendering
id="controlled-radiogroup"
accessibilityLabel="options"
label="options"
checked={ checked }
onChange={ setChecked }
>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/radio/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const _default = () => {
/* eslint-disable no-restricted-syntax */
return (
// id is required for server side rendering
<RadioGroup id="default-radiogroup" accessibilityLabel="options">
<RadioGroup id="default-radiogroup" label="options">
<Radio value="option1">Option 1</Radio>
<Radio value="option2">Option 2</Radio>
</RadioGroup>
Expand Down

0 comments on commit 54db7e2

Please sign in to comment.