Skip to content

Commit

Permalink
feat(Datagrid): add keyboard support for clickable rows (#2914)
Browse files Browse the repository at this point in the history
* feat(Datagrid): add keyboard support to useOnRowClick

* chore(Datagrid): refactor key down fn name

---------

Co-authored-by: Alexander Melo <[email protected]>
  • Loading branch information
matthewgallo and AlexanderMelox authored Apr 26, 2023
1 parent cff465d commit cbdecd8
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ const useOnRowClick = (hooks) => {
}
};

const onKeyDown = (event) => {
const { key } = event;
if (key === 'Enter') {
onClick();
}
};

return [
props,
{ onClick },
{ onClick, onKeyDown },
{
tabIndex: 0,
style: {
cursor: 'pointer',
},
Expand Down

0 comments on commit cbdecd8

Please sign in to comment.