Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(radio): Radio group compliant with ARIA patterns #229

Merged
merged 41 commits into from
Sep 20, 2018

Conversation

jurokapsiar
Copy link
Contributor

@jurokapsiar jurokapsiar commented Sep 14, 2018

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 with RadioGroup.Item

TODO

  • Conformance test
  • Minimal doc site example
  • Stardust base theme
  • Teams Light theme
  • Teams Dark theme
  • Teams Contrast theme
  • Confirm RTL usage
  • W3 accessibility check
  • Stardust accessibility check
  • Update glossary props table
  • Update the CHANGELOG.md

API Proposal

[Group]

image

<RadioGroup defaultCheckedIndex={0} items={items} onChange={this.handleChange} />
  <div role="radiogroup" class="ui-radiogroup">
    <div role="radio" tabindex="0" aria-checked="true" index="0" class="ui-radio f g">
      <span class="ui-label ...">
        <span class="ui-icon ..." aria-hidden="true"></span>
        Capricciosa
      </span>
    </div>
  </div>

Comparison of approaches that I tried: (the last row is this implementation)
image

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))
Copy link
Contributor

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

defaultProps: {
index,
checked: parseInt(checkedIndex, 10) === index,
},
Copy link
Contributor

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?

@kuzhelov kuzhelov added needs author changes Author needs to implement changes before merge and removed 🚀 ready for review labels Sep 18, 2018
@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #229 into master will decrease coverage by 2.01%.
The diff coverage is 71.96%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/index.ts 100% <100%> (ø) ⬆️
src/components/RadioGroup/index.ts 100% <100%> (ø)
src/components/Button/Button.tsx 95.83% <100%> (-0.09%) ⬇️
src/components/RadioGroup/RadioGroup.tsx 51.72% <51.72%> (ø)
src/components/RadioGroup/RadioGroupItem.tsx 94.73% <94.73%> (ø)
src/components/Provider/Provider.tsx 60.46% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6bdbaa...e44405b. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #229 into master will decrease coverage by 2.01%.
The diff coverage is 71.96%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/index.ts 100% <100%> (ø) ⬆️
src/components/RadioGroup/index.ts 100% <100%> (ø)
src/components/Button/Button.tsx 95.83% <100%> (-0.09%) ⬇️
src/components/RadioGroup/RadioGroup.tsx 51.72% <51.72%> (ø)
src/components/RadioGroup/RadioGroupItem.tsx 94.73% <94.73%> (ø)
src/components/Provider/Provider.tsx 60.46% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6bdbaa...e44405b. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #229 into master will increase coverage by 0.41%.
The diff coverage is 97.27%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/index.ts 100% <100%> (ø) ⬆️
src/components/RadioGroup/index.ts 100% <100%> (ø)
src/components/RadioGroup/RadioGroupItem.tsx 100% <100%> (ø)
src/components/Button/Button.tsx 95.83% <100%> (-0.09%) ⬇️
src/components/RadioGroup/RadioGroup.tsx 95% <95%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8204304...fa268a5. Read the comment docs.

@@ -3,10 +3,12 @@ import { mount } from './isConformant'

export type ShorthandTestOptions = {
mapsValueToProp?: string
skipArrayOfStrings?: boolean
}

Copy link
Contributor

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.

@jurokapsiar jurokapsiar added 🚀 ready for review and removed needs author changes Author needs to implement changes before merge labels Sep 19, 2018
@mnajdova
Copy link
Contributor

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.

@jurokapsiar jurokapsiar changed the title BREAKING: Feat/radio group compliant with ARIA patterns Feat(radio): radio group compliant with ARIA patterns Sep 20, 2018
@jurokapsiar jurokapsiar changed the title Feat(radio): radio group compliant with ARIA patterns feat(radio): Radio group compliant with ARIA patterns Sep 20, 2018
@jurokapsiar jurokapsiar merged commit 5e5fac6 into master Sep 20, 2018
@jurokapsiar
Copy link
Contributor Author

fixes #195

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants