Skip to content

Commit

Permalink
Add support for the aria-label attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neurrone committed Aug 13, 2019
1 parent b03f44b commit 146b180
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Widget extends React.Component {
render() {
return (
<CheckboxTree
aria-label='Moons'
nodes={nodes}
checked={this.state.checked}
expanded={this.state.expanded}
Expand Down Expand Up @@ -135,6 +136,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
| Property | Type | Description | Default |
| -------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | ----------- |
| `nodes` | array | **Required**. Specifies the tree nodes and their children. | |
| `aria-label` | string | a short label that describes the purpose of the tree | `null` |
| `checked` | array | An array of checked node values. | `[]` |
| `disabled` | bool | If true, the component will be disabled and nodes cannot be checked. | `false` |
| `expandDisabled` | bool | If true, the ability to expand nodes will be disabled. | `false` |
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/BasicExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class BasicExample extends React.Component {

return (
<CheckboxTree
aria-label='Basic Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/ClickableLabelsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ClickExample extends React.Component {
return (
<div className="clickable-labels">
<CheckboxTree
aria-label='Clickable Labels Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/CustomIconsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class CustomIconsExamples extends React.Component {

return (
<CheckboxTree
aria-label='Custom Icons Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/DisabledExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class DisabledExample extends React.Component {

return (
<CheckboxTree
aria-label='Disabled Example'
checked={checked}
disabled
expanded={expanded}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/ExpandAllExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class ExpandAllExample extends React.Component {
return (
<div className="expand-all-container">
<CheckboxTree
aria-label='Expand All/Collapse All Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/FilterExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class FilterExample extends React.Component {
onChange={this.onFilterChange}
/>
<CheckboxTree
aria-label='Filter Example'
checked={checked}
expanded={expanded}
nodes={nodesFiltered}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/HiddenCheckboxesExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class HiddenCheckboxesExample extends React.Component {

return (
<CheckboxTree
aria-label='Hide Checkboxes Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/LargeDataExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class LargeDataExample extends React.Component {

return (
<CheckboxTree
aria-label='Large Data Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/NoCascadeExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class NoCascadeExample extends React.Component {

return (
<CheckboxTree
aria-label='No Cascading Example'
checked={checked}
expanded={expanded}
noCascade
Expand Down
1 change: 1 addition & 0 deletions examples/src/js/PessimisticToggleExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class PessimisticToggleExample extends React.Component {

return (
<CheckboxTree
aria-label='Pessimistic Toggle Example'
checked={checked}
expanded={expanded}
nodes={nodes}
Expand Down
3 changes: 3 additions & 0 deletions src/js/CheckboxTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CheckboxTree extends React.Component {
static propTypes = {
nodes: PropTypes.arrayOf(nodeShape).isRequired,

'aria-label': PropTypes.string,
checked: listShape,
disabled: PropTypes.bool,
expandDisabled: PropTypes.bool,
Expand All @@ -53,6 +54,7 @@ class CheckboxTree extends React.Component {
};

static defaultProps = {
'aria-label': null,
checked: [],
disabled: false,
expandDisabled: false,
Expand Down Expand Up @@ -450,6 +452,7 @@ class CheckboxTree extends React.Component {
{this.renderExpandAll()}
{this.renderHiddenInput()}
<div
aria-label={this.props['aria-label']}
onFocus={this.onFocus}
onKeyDown={this.onKeyDown}
role="tree"
Expand Down

0 comments on commit 146b180

Please sign in to comment.