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

fix(button): set aria-pressed to props.isSelected for icon-only ghost #7900

Merged
merged 3 commits into from
Feb 25, 2021

Conversation

janhassel
Copy link
Member

@janhassel janhassel commented Feb 25, 2021

Related #7757, #7784

Following the WAI-ARIA Authoring Practices for toggle buttons, this PR sets the button's aria-pressed attribute according to props.isSelected (if it is icon-only and ghost).

Changelog

New

  • added aria-pressed attribute to button icon-only ghost buttons to reflect props.isSelected

Changed

  • Updated jest snapshots that use icon-only ghost buttons

Testing / Reviewing

  • When props.isSelected is not passed, the button should not have the aria-pressed attribute.
  • When props.isSelected = false is passed, the button should have aria-pressed="false"
  • When props.isSelected = true is passed, the button should have aria-pressed="true"
  • When props.isSelected = true is passed but the button is not icon-only and ghost, the butto should not have the aria-pressedattribute

@janhassel janhassel requested a review from a team as a code owner February 25, 2021 08:44
@netlify
Copy link

netlify bot commented Feb 25, 2021

Deploy preview for carbon-elements ready!

Built with commit 89a00e9

https://deploy-preview-7900--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Feb 25, 2021

Deploy preview for carbon-components-react ready!

Built without sensitive environment variables with commit 89a00e9

https://deploy-preview-7900--carbon-components-react.netlify.app

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✅

@kodiakhq kodiakhq bot merged commit e5cb20c into carbon-design-system:master Feb 25, 2021
@dakahn dakahn mentioned this pull request Mar 4, 2021
@janhassel janhassel deleted the selected-button branch March 16, 2021 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants