-
Notifications
You must be signed in to change notification settings - Fork 647
fix(Radio): remove redundant aria-disabled #2635
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2b60544
fix(Radio): remove redundant aria-disabled
joshblack 914b110
test(e2e): refactor toHaveNoViolations to use axe-core directly for c…
joshblack 76bf900
test: update Radio test snapshots
joshblack 9fdde00
Merge branch 'main' of github.com:primer/react into 2634-update-radio…
joshblack c610e27
chore: add changeset
joshblack 1f0dadc
test(vrt): update snapshots
joshblack 35f0b39
test: update snapshots
joshblack 450d1c5
Merge branch '2634-update-radio-disabled' of github.com:primer/react …
joshblack 98fe4b6
Merge branch 'main' of github.com:primer/react into 2634-update-radio…
joshblack 371e00b
Merge branch 'main' of github.com:primer/react into 2634-update-radio…
joshblack 6adf69f
chore: run prettier
joshblack dcda7c4
chore(project): update package.json
joshblack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/react': patch | ||
| --- | ||
|
|
||
| Update Radio to only use disabled when provided and no longer set aria-disabled |
Binary file added
BIN
+12.8 KB
...nents/RadioGroup.test.ts-snapshots/RadioGroup-Default-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...omponents/RadioGroup.test.ts-snapshots/RadioGroup-Default-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...ts/RadioGroup.test.ts-snapshots/RadioGroup-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...shots/components/RadioGroup.test.ts-snapshots/RadioGroup-Default-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...nents/RadioGroup.test.ts-snapshots/RadioGroup-Default-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...ioGroup.test.ts-snapshots/RadioGroup-Default-disabled-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.2 KB
.../RadioGroup.test.ts-snapshots/RadioGroup-Default-disabled-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...roup.test.ts-snapshots/RadioGroup-Default-disabled-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...ponents/RadioGroup.test.ts-snapshots/RadioGroup-Default-disabled-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...ioGroup.test.ts-snapshots/RadioGroup-Default-disabled-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...oGroup.test.ts-snapshots/RadioGroup-Default-disabled-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...oup.test.ts-snapshots/RadioGroup-Default-disabled-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...onents/RadioGroup.test.ts-snapshots/RadioGroup-Default-disabled-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...oGroup.test.ts-snapshots/RadioGroup-Default-disabled-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...ents/RadioGroup.test.ts-snapshots/RadioGroup-Default-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...s/RadioGroup.test.ts-snapshots/RadioGroup-Default-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...hots/components/RadioGroup.test.ts-snapshots/RadioGroup-Default-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...ents/RadioGroup.test.ts-snapshots/RadioGroup-Default-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import {test, expect} from '@playwright/test' | ||
| import {visit} from '../test-helpers/storybook' | ||
| import {themes} from '../test-helpers/themes' | ||
|
|
||
| test.describe('RadioGroup', () => { | ||
| test.describe('Default', () => { | ||
| for (const theme of themes) { | ||
| test.describe(theme, () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-forms-radiogroup-examples--default', | ||
| globals: { | ||
| colorScheme: theme, | ||
| }, | ||
| }) | ||
|
|
||
| // Default state | ||
| expect(await page.screenshot()).toMatchSnapshot(`RadioGroup.Default.${theme}.png`) | ||
| }) | ||
|
|
||
| test('disabled @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-forms-radiogroup-examples--default', | ||
| globals: { | ||
| colorScheme: theme, | ||
| }, | ||
| args: { | ||
| disabled: true, | ||
| }, | ||
| }) | ||
|
|
||
| expect(await page.screenshot()).toMatchSnapshot(`RadioGroup.Default.disabled.${theme}.png`) | ||
|
|
||
| await expect(page).toHaveNoViolations({ | ||
| rules: { | ||
| 'color-contrast': { | ||
| enabled: theme !== 'dark_dimmed', | ||
| }, | ||
| }, | ||
| }) | ||
| }) | ||
|
|
||
| test('disabled @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-forms-radiogroup-examples--default', | ||
| globals: { | ||
| colorScheme: theme, | ||
| }, | ||
| args: { | ||
| disabled: true, | ||
| }, | ||
| }) | ||
|
|
||
| await expect(page).toHaveNoViolations({ | ||
| rules: { | ||
| 'color-contrast': { | ||
| enabled: theme !== 'dark_dimmed', | ||
| }, | ||
| }, | ||
| }) | ||
| }) | ||
|
|
||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-forms-radiogroup-examples--default', | ||
| globals: { | ||
| colorScheme: theme, | ||
| }, | ||
| }) | ||
| await expect(page).toHaveNoViolations({ | ||
| rules: { | ||
| 'color-contrast': { | ||
| enabled: theme !== 'dark_dimmed', | ||
| }, | ||
| }, | ||
| }) | ||
| }) | ||
| }) | ||
| } | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @joshblack! Sorry, I am a bit confused about why we removed
aria-disabled. I understand that the GitHub axe rule of having both attribute are conflicting and it makes sense but here it saysI would expect us to remove the
disabledand update styling accordingly? 🤔 I might be missing something, sorry but would be great to clarify this, then I'll continue to review 😊There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@broccolinisoup makes sense to me! Happy to make that change 👍
Maybe what I can do is add this to our next major release ticket with the following changes in mind:
Radioshould no longer accept adisabledprop (this we would have to remove in the next major)Radioin the interim acceptsdisabledoraria-disabled(but not both) and styling/behavior should apply in either scenarioCurious what you think 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joshblack!
I really like that 🙌🏼 Can we also check it with the accessibility team to make sure if they don't suggest anything else or anything more?
My gut feeling says we should allow
aria-disablednotdisabledbut I recognise the effort around updating the styles to make sure the ones witharia-disabledlook disabled too. So maybe we can merge your PR as is now as the interim solution and make sure we have issue to address removingdisabledin the next major realised? Does that sound good at all?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely! I'll reach out.
Makes sense to me! I think the only catch is that we can't remove support for
disabledwithout it being a breaking change. I think that's where some of the interim ideas were coming from (support either case but not both at the same time). Are you thinking of havingdisabledmap toaria-disabledor were you wanting to remove it as part of addressing the parent issue?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes like mapping. We could still keep the
disabledprop in the api but render asaria-disabledin the HTML however I just checked the implementation and it is mostly used within the FormControl which makes sense and mapping would make things unnecessarily complicated. Sorry that was a bit non-sense 😆Your solution to remove the warning is the most effective and doable way, I 100% agree. Hope to bring
aria-disabledback with a major update to make it more accessible.Sorry for lingering around with not very doable solutions, I'll approved the PR 🚀