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

feat(RadioGroup): improve radio-group components a11y #196

Merged
merged 2 commits into from
Jan 20, 2023
Merged

Conversation

amje
Copy link
Contributor

@amje amje commented Jun 15, 2022

Closes #179

@amje amje requested a review from ierehon1905 June 15, 2022 19:00
@amje amje self-assigned this Jun 15, 2022
@yc-ui-bot
Copy link
Contributor

Preview is ready.

@@ -14,10 +14,12 @@ const options: RadioButtonOption[] = [
{value: 'Value 3', content: 'Value 3'},
];

const DefaultTemplate: Story<RadioButtonProps> = (args) => <RadioButton {...args} />;
const DefaultTemplate: Story<RadioButtonProps> = (args) => {
const [value, setValue] = React.useState<string>(options[0].value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use storybook controls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it able to set control value from callback? Otherwise example wont be interactive.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, storybook is not intended to be interactive, it is more like UI snapshots than demos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's kinda weird when you open a demo and it's not working properly. And the only way to change the value is to do it by hand.

src/components/utils/useRadioGroup.ts Show resolved Hide resolved
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@amje amje changed the title feat: improve radio-group components a11y feat(RadioGroup): improve radio-group components a11y Jan 20, 2023
@amje amje requested a review from ogonkov January 20, 2023 15:35
Comment on lines +44 to +45
'aria-label': props['aria-label'],
'aria-labelledby': props['aria-labelledby'],
Copy link
Contributor

Choose a reason for hiding this comment

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

if aria-label set, aria-labelledby should not be setted

Copy link
Contributor

Choose a reason for hiding this comment

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

and vice versa

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like i was wrong

@amje amje merged commit 70f36ea into main Jan 20, 2023
@amje amje deleted the radio-button-focus branch January 20, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RadioButton does not call onFocus and onBlur
4 participants