Skip to content
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

feat(ObjectViewer): improve a11y #1616

Merged
merged 45 commits into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ae8cb0a
feat(ObjectViewer): improve a11y
jsomsanith-tlnd Aug 13, 2018
1010a8d
test(ci): update code style outputs
Aug 13, 2018
6f0d9f7
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Aug 14, 2018
2b5fa59
Continue refactor
jsomsanith-tlnd Aug 14, 2018
d2e439c
test(ci): update code style outputs
Aug 14, 2018
c01750a
test(ci): prettier
Aug 14, 2018
92227d0
Fix ellipsis
jsomsanith-tlnd Aug 16, 2018
7ec39fa
test(ci): update code style outputs
Aug 16, 2018
e5e3166
Add text alternatives to possible gestures
jsomsanith-tlnd Aug 16, 2018
730a802
test(ci): update code style outputs
Aug 16, 2018
d56ee41
Clean style
jsomsanith-tlnd Aug 16, 2018
776982a
Tests
jsomsanith-tlnd Aug 16, 2018
e3c1655
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Aug 16, 2018
78f40da
test(ci): update code style outputs
Aug 16, 2018
615625d
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Aug 22, 2018
2023001
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Aug 28, 2018
4e48c0c
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Aug 29, 2018
17ce6df
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 6, 2018
8331420
Continue
jsomsanith-tlnd Sep 7, 2018
e3680b7
Continue
jsomsanith-tlnd Sep 7, 2018
b66fa38
chore(ci): update code style outputs
Sep 7, 2018
c8e65bb
Continue
jsomsanith-tlnd Sep 10, 2018
bb53d23
Fix treeview
jsomsanith-tlnd Sep 10, 2018
57576b3
chore(ci): update code style outputs
Sep 10, 2018
0e872fb
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 10, 2018
0d9d4f0
Fix component unit tests
jsomsanith-tlnd Sep 10, 2018
0ae54b2
Fix container tests
jsomsanith-tlnd Sep 10, 2018
a5818a2
chore(ci): update code style outputs
Sep 10, 2018
bde8621
Clean
jsomsanith-tlnd Sep 10, 2018
a9a5215
Clean
jsomsanith-tlnd Sep 10, 2018
bca233f
chore(ci): update code style outputs
Sep 10, 2018
d6f216a
chore(ci): update code style outputs
Sep 10, 2018
da3777e
Fixes
jsomsanith-tlnd Sep 11, 2018
a928473
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 11, 2018
0f0f7dd
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 13, 2018
c500007
Fix * gesture
jsomsanith-tlnd Sep 14, 2018
42c42a9
Fixes after review
jsomsanith-tlnd Sep 14, 2018
5e1e42c
chore(ci): update code style outputs
Sep 14, 2018
0644ef1
Fix
jsomsanith-tlnd Sep 17, 2018
c0f972b
Fix after review
jsomsanith-tlnd Sep 17, 2018
71f224d
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 17, 2018
a177add
chore(ci): update code style outputs
Sep 17, 2018
7086d27
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 17, 2018
286c472
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 18, 2018
e6f1a98
Merge branch 'master' into jsomsanith/feat/a11y_object_viewer
jsomsanith-tlnd Sep 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions output/components.eslint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ The react/require-extension rule is deprecated. Please use the import/extensions
/home/travis/build/Talend/ui/packages/components/src/HeaderBar/HeaderBar.component.js
105:37 error Elements with ARIA roles must use a valid, non-abstract ARIA role jsx-a11y/aria-role

/home/travis/build/Talend/ui/packages/components/src/ObjectViewer/JSONLike/JSONLike.component.js
56:3 error Visible, non-interactive elements should not have mouse or keyboard event listeners jsx-a11y/no-static-element-interactions

/home/travis/build/Talend/ui/packages/components/src/VirtualizedList/RowLarge/RowLarge.component.js
47:3 error Visible, non-interactive elements should not have mouse or keyboard event listeners jsx-a11y/no-static-element-interactions

/home/travis/build/Talend/ui/packages/components/src/VirtualizedList/utils/tablerow.js
33:3 warning Unexpected console statement no-console

4 problems (3 errors, 1 warning)
3 problems (2 errors, 1 warning)

65 changes: 65 additions & 0 deletions packages/components/__mocks__/tree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import PropTypes from 'prop-types';
import React from 'react';

class TreeItem extends React.Component {
render() {
return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<li
id={this.props.item.id}
role="treeitem"
tabIndex="-1"
onKeyDown={e => this.props.onKeyDown(e, this.ref, this.props.item)}
ref={ref => {
this.ref = ref;
}}
aria-level={this.props.level}
aria-posinset={this.props.posinset}
>
{name}
{this.props.item.isOpened ? this.props.children : null}
</li>
);
}
}
TreeItem.propTypes = {
children: PropTypes.node,
id: PropTypes.string,
isOpened: PropTypes.bool,
item: PropTypes.object,
level: PropTypes.number,
onKeyDown: PropTypes.func.isRequired,
posinset: PropTypes.number,
};

function Tree(props) {
return (
<ul role={props.level === 0 ? 'tree' : undefined}>
{props.items.map((item, index) => (
<TreeItem
key={`item-${props.level}-${index}`}
onKeyDown={props.onKeyDown}
item={item}
name={`Item ${props.level} ${index}`}
level={props.level}
posinset={index}
>
{item.children && (
<Tree key="children" {...props} items={item.children} level={props.level + 1} />
)}
</TreeItem>
))}
</ul>
);
}
Tree.displayName = 'Tree';
Tree.defaultProps = {
items: [],
level: 0,
};
Tree.propTypes = {
items: PropTypes.array,
level: PropTypes.number,
};

export default Tree;
Loading