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

Commit 9261d40

Browse files
authored
docs(accessibility): add decsriptions to components and behaviors (#648)
add acc decsriptions to components and behaviors
1 parent 9f66a14 commit 9261d40

File tree

12 files changed

+41
-14
lines changed

12 files changed

+41
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3434
- Add `menu` prop to `MenuItem` @mnajdova ([#539](https://github.com/stardust-ui/react/pull/539))
3535
- Enable RTL for `FocusZone` @sophieH29 ([#646](https://github.com/stardust-ui/react/pull/646))
3636

37+
### Documentation
38+
- Add more accessibility descriptions to components and behaviors @jurokapsiar ([#648](https://github.com/stardust-ui/react/pull/648))
39+
3740
<!--------------------------------[ v0.15.0 ]------------------------------- -->
3841
## [v0.15.0](https://github.com/stardust-ui/react/tree/v0.15.0) (2018-12-17)
3942
[Compare changes](https://github.com/stardust-ui/react/compare/v0.14.0...v0.15.0)

docs/src/components/ComponentDoc/ComponentDocAccessibility.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const ComponentDocAccessibility = ({ info }) => {
2626
variables={{ color: 'black' }}
2727
/>
2828

29+
{description && <p style={{ whiteSpace: 'pre-line' }}>{description}</p>}
30+
2931
{behaviorName && (
3032
<p>
3133
Default behavior:{' '}
@@ -45,8 +47,6 @@ const ComponentDocAccessibility = ({ info }) => {
4547
))}
4648
</p>
4749
)}
48-
49-
{description && <p style={{ whiteSpace: 'pre-line' }}>{description}</p>}
5050
</>
5151
)
5252
}

docs/src/components/DocsBehaviorRoot.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,31 @@ class DocsBehaviorRoot extends React.Component<any, any> {
6969
</div>
7070
</Grid.Column>
7171
<div style={{ padding: '1em' }}>
72-
<span> Description: </span>
73-
<br />
74-
{variation.description &&
75-
variation.description.split('\n').map((splittedText, keyValue) => {
76-
return (
72+
{variation.description && (
73+
<>
74+
<strong>Description:</strong>
75+
<br />
76+
{variation.description.split('\n').map((splittedText, keyValue) => (
7777
<span key={keyValue}>
7878
{splittedText}
7979
<br />
8080
</span>
81-
)
82-
})}
83-
{variation.specification &&
84-
variation.specification.split('\n').map((splittedText, keyValue) => {
85-
return (
81+
))}
82+
</>
83+
)}
84+
{variation.specification && (
85+
<>
86+
{variation.description && <br />}
87+
<strong>Specification:</strong>
88+
<br />
89+
{variation.specification.split('\n').map((splittedText, keyValue) => (
8690
<span key={keyValue}>
8791
{splittedText}
8892
<br />
8993
</span>
90-
)
91-
})}
94+
))}
95+
</>
96+
)}
9297
</div>
9398
</Grid.Row>
9499
))}

src/components/Accordion/Accordion.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export interface AccordionProps extends UIComponentProps, ChildrenComponentProps
7171

7272
/**
7373
* An accordion allows users to toggle the display of sections of content.
74+
* @accessibility
75+
* Implements ARIA Accordion design pattern (keyboard navigation not yet supported).
76+
* Consider using Tree if you intend to wrap Lists in an Accordion.
7477
*/
7578
class Accordion extends AutoControlledComponent<ReactProps<AccordionProps>, any> {
7679
static displayName = 'Accordion'

src/components/Dropdown/Dropdown.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ export interface DropdownState {
123123
/**
124124
* Dropdown allows user to select one or more values from a list of items.
125125
* Can also be created with search capability.
126+
* @accessibility
127+
* Implements ARIA collapsible Listbox design pattern, uses aria-live to announce state changes.
126128
*/
127129
export default class Dropdown extends AutoControlledComponent<
128130
Extendable<DropdownProps>,

src/components/Menu/Menu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export interface MenuState {
7272

7373
/**
7474
* A menu displays grouped navigation actions.
75+
* @accessibility
76+
* Implements ARIA Menu, Toolbar or Tabs design pattern, depending on the behavior used.
7577
*/
7678
class Menu extends AutoControlledComponent<ReactProps<MenuProps>, MenuState> {
7779
static displayName = 'Menu'

src/components/RadioGroup/RadioGroup.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export interface RadioGroupProps extends UIComponentProps, ChildrenComponentProp
4646

4747
/**
4848
* A radio group allows a user to select a value from a small set of options.
49+
* @accessibility
50+
* Implements ARIA Radio Group design pattern.
4951
*/
5052
class RadioGroup extends AutoControlledComponent<ReactProps<RadioGroupProps>, any> {
5153
static displayName = 'RadioGroup'

src/lib/accessibility/Behaviors/Dialog/dialogBehavior.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import popupFocusTrapBehavior from '../Popup/popupFocusTrapBehavior'
33

44
/**
55
* @description
6+
* Implements ARIA Dialog (Modal) design pattern.
67
* Adds role='button' to 'trigger' component's part, if it is not focusable element and no role attribute provided.
78
* Adds tabIndex='0' to 'trigger' component's part, if it is not tabbable element and no tabIndex attribute provided.
89
*

src/lib/accessibility/Behaviors/Menu/menuBehavior.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FocusZoneDirection } from '../../FocusZone'
33

44
/**
55
* @description
6+
* Implements ARIA Menu design pattern.
67
* The 'menu' role is used to identify an element that creates a list of common actions or functions that a user can invoke.
78
*
89
* @specification

src/lib/accessibility/Behaviors/Radio/radioGroupBehavior.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Accessibility } from '../../types'
22
import * as keyboardKey from 'keyboard-key'
33

44
/**
5+
* @description
6+
* Implements ARIA Radio Group design pattern.
57
* @specification
68
* Adds role='radiogroup'. This allows screen readers to handle the component as a radio group.
79
* Performs 'nextItem' action on ArrowDown, ArrowRight.

src/lib/accessibility/Behaviors/Tab/tabListBehavior.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Accessibility, FocusZoneMode } from '../../types'
22

33
/**
4+
* @description
5+
* Implements ARIA Tabs design pattern.
6+
* Child item components need to have tabBehavior assigned.
47
* @specification
58
* Adds role 'tablist' to 'root' component's part.
69
* Embeds FocusZone into component allowing arrow key navigation through the children of the component.

src/lib/accessibility/Behaviors/Toolbar/toolbarBehavior.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Accessibility, FocusZoneMode } from '../../types'
22

33
/**
4+
* @description
5+
* Implements ARIA Toolbar design pattern.
6+
* Child item components need to have toolbarButtonBehavior assigned.
47
* @specification
58
* Adds role 'toolbar' to 'root' component's part.
69
* Embeds FocusZone into component allowing arrow key navigation through the children of the component.

0 commit comments

Comments
 (0)