-
Notifications
You must be signed in to change notification settings - Fork 55
feat(radio): Radio group compliant with ARIA patterns #229
Conversation
… the Radio component
…eact into feat/radio-checked
-reverted the Radio to extend UIComponent
-styles the Radio button with custom icon
-addressed comments in the PR
This reverts commit ec60c8b.
# Conflicts: # docs/src/examples/components/Radio/index.tsx # src/components/Radio/Radio.tsx # src/index.ts # src/themes/teams/components/Radio/radioStyles.ts # src/themes/teams/components/Radio/radioVariables.ts
CHANGELOG.md
Outdated
@@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | |||
- Fixed missing colors in Teams' siteVariables @mnajdova ([#200](https://github.com/stardust-ui/react/pull/200)) | |||
- Fixed Teams' siteVariables font sizes @levithomason ([#204](https://github.com/stardust-ui/react/pull/204)) | |||
- Fixed docs examples of `Text` component @codepretty ([#205](https://github.com/stardust-ui/react/pull/205)) | |||
- Add `value`, `disabled`, `checked`, `defaultChecked` and `onChange` props to `Radio` component @mnajdova ([#206](https://github.com/stardust-ui/react/pull/206)) | |||
- Preserve fonts and static styles in mergeThemes @levithomason ([#217](https://github.com/stardust-ui/react/pull/217)) |
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.
Please delete this from here, it was added in the unreleased section
src/components/Radio/RadioGroup.tsx
Outdated
defaultProps: { | ||
index, | ||
checked: parseInt(checkedIndex, 10) === index, | ||
}, |
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.
Maybe is better that we use the value for this instead of index? Is there reason why we are using index?
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
==========================================
- Coverage 91.84% 89.82% -2.02%
==========================================
Files 61 62 +1
Lines 1042 1111 +69
Branches 134 166 +32
==========================================
+ Hits 957 998 +41
- Misses 82 110 +28
Partials 3 3
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
==========================================
- Coverage 91.84% 89.82% -2.02%
==========================================
Files 61 62 +1
Lines 1042 1111 +69
Branches 134 166 +32
==========================================
+ Hits 957 998 +41
- Misses 82 110 +28
Partials 3 3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #229 +/- ##
==========================================
+ Coverage 92.15% 92.57% +0.41%
==========================================
Files 61 62 +1
Lines 1058 1131 +73
Branches 155 168 +13
==========================================
+ Hits 975 1047 +72
- Misses 80 81 +1
Partials 3 3
Continue to review full report at Codecov.
|
@@ -3,10 +3,12 @@ import { mount } from './isConformant' | |||
|
|||
export type ShorthandTestOptions = { | |||
mapsValueToProp?: string | |||
skipArrayOfStrings?: boolean | |||
} | |||
|
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.
Let's not change this interface, but create new one specific for the collection shorthand, as skipArrayOfStrings is not in any way used in the simple shorthand. The last option how the shorthand can be used is a function with signature: (Component, props, children) => React.Node
. If we are not supporting this one, maybe we should add config for this one as well.
As per our discussion the next step would be introducing variables for the RadioGroup with slot for the items, but we are leaving this for dedicated PR. In my opinion this is good to be merged now. |
# Conflicts: # src/components/Radio/Radio.tsx
fixes #195 |
RadioGroup
This is a ARIA-patterns compliant implementation of Radio and RadioGroup.
My initial testing shows that it works with all required screen reader/browser combinations.
The only exception is that the focused option is not highlighted with JAWS in virtual cursor mode.
This breaks the current Radio API as
Radio
is replaced withRadioGroup.Item
TODO
API Proposal
[Group]
Comparison of approaches that I tried: (the last row is this implementation)