Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace accessibilityLabel by label on RadioGroup #25128

Merged
merged 1 commit into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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