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(radio, radio-group): Enhance accessibility with arrow key navigation and aria attributes #951

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

mryunt02
Copy link
Contributor

This PR addresses and resolves issue #950.

Changes Made:

  • Implemented arrow key navigation for the Radio Group component.
    • Down/Right Arrow:
      • Moves focus to and checks the next radio button in the group.
      • If focus is on the last radio button, moves focus to the first radio button.
      • The state of the previously checked radio button is changed to unchecked.
    • Up/Left Arrow:
      • Moves focus to and checks the previous radio button in the group.
      • If focus is on the first radio button, moves focus to and checks the last radio button.
      • The state of the previously checked radio button is changed to unchecked.
  • Removed the aria-readonly property from the Radio Button component.
  • Added the aria-checked attribute to the Radio Button component to indicate its checked state.

These changes improve the accessibility and user experience of the Radio Group component in compliance with W3C ARIA Radio Group Example.

This PR resolves issue #950.

@mryunt02 mryunt02 changed the title Feat/radio, radio-group a11y feat(radio, radio-group): a11y Oct 21, 2024
@mryunt02 mryunt02 changed the title feat(radio, radio-group): a11y feat(radio, radio-group): Enhance accessibility with arrow key navigation and aria attributes Oct 21, 2024
@mryunt02
Copy link
Contributor Author

this PR fails the test but I think it is necessary, I did not change the test file to avoid breaking it.

@@ -19,7 +19,7 @@ describe("bl-radio", () => {
`<div
aria-disabled="false"
aria-labelledby="label"
aria-readonly="false"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don’t quite understand why you did this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aria-readonly property is not supported in Radio Group according to W3C ARIA Radio Group Example

Copy link
Contributor

@Enes5519 Enes5519 left a comment

Choose a reason for hiding this comment

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

It would be better to capitalize the first letter of the labels.

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.

3 participants