Skip to content

Commit

Permalink
Merge pull request #154 from fedspendingtransparency/mod/9527-make-ta…
Browse files Browse the repository at this point in the history
…ble-rows-tabbable

9527 - added tabIndex and onKeyPress to rows in TableData.jsx to make…
  • Loading branch information
anjenkin authored Mar 8, 2023
2 parents 8e11a0b + d235951 commit de73320
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion components/table/TableData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const propTypes = {
rows: PropTypes.arrayOf(oneOfType([PropTypes.array, PropTypes.object])).isRequired,
expandable: PropTypes.bool,
divider: PropTypes.string,
onClickHandler: PropTypes.string,
onClickHandler: PropTypes.func,
isMobile: PropTypes.bool
};

Expand Down Expand Up @@ -50,6 +50,7 @@ const TableData = ({
onClickHandler(row);
}
}

return (
<>
{rows.map((row, i) => {
Expand All @@ -69,7 +70,14 @@ const TableData = ({
return (
<tr
key={uniqueId()}
tabIndex={0}
onClick={() => localClickHandler(row, i)}
onKeyUp={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
localClickHandler(row, i);
}
}}
className={`usda-table__row-item usda-table__row${oddClass}`}>
{row.map((data, j) => (
columns[j]?.bodyHeader ?
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,4 @@



window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook","files":"**/stories/*.stories.@(mdx|js)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)stories\\/(?!\\.)(?=.)[^/]*?\\.stories\\.(mdx|js))$"}];</script><script src="runtime~main.cb41af90.iframe.bundle.js"></script><script src="224.095806cb.iframe.bundle.js"></script><script src="main.e596057a.iframe.bundle.js"></script></body></html>
window['STORIES'] = [{"titlePrefix":"","directory":"./.storybook","files":"**/stories/*.stories.@(mdx|js)","importPathMatcher":"^\\.[\\\\/](?:\\.storybook(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)stories\\/(?!\\.)(?=.)[^/]*?\\.stories\\.(mdx|js))$"}];</script><script src="runtime~main.cb41af90.iframe.bundle.js"></script><script src="224.095806cb.iframe.bundle.js"></script><script src="main.7959d154.iframe.bundle.js"></script></body></html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-transparency-ui",
"version": "5.2.7",
"version": "5.2.8",
"description": "Library of UI components powering Data Transparency websites",
"main": "dist/index.js",
"style": "dist/data-transparency-ui.css",
Expand Down

0 comments on commit de73320

Please sign in to comment.