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

Support for passing event objects thru to various event handlers #605

Merged
merged 1 commit into from
Mar 4, 2017
Merged
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions source/Table/Table.js
Original file line number Diff line number Diff line change
@@ -403,17 +403,17 @@ export default class Table extends PureComponent {
? SortDirection.ASC
: SortDirection.DESC

const onClick = () => {
const onClick = (evt) => {
sortEnabled && sort({
sortBy: dataKey,
sortDirection: newSortDirection
})
onHeaderClick && onHeaderClick({ columnData, dataKey })
onHeaderClick && onHeaderClick({ evt, columnData, dataKey })
}

const onKeyDown = (event) => {
if (event.key === 'Enter' || event.key === ' ') {
onClick()
onClick(event)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit weird- though I understand why you did it. I guess it's okay since people can ignore the event or check its type

}
}

8 changes: 4 additions & 4 deletions source/Table/defaultRowRenderer.js
Original file line number Diff line number Diff line change
@@ -31,16 +31,16 @@ export default function defaultRowRenderer ({
a11yProps.tabIndex = 0

if (onRowClick) {
a11yProps.onClick = () => onRowClick({ index, rowData })
a11yProps.onClick = (evt) => onRowClick({ evt, index, rowData })
}
if (onRowDoubleClick) {
a11yProps.onDoubleClick = () => onRowDoubleClick({ index, rowData })
a11yProps.onDoubleClick = (evt) => onRowDoubleClick({ evt, index, rowData })
}
if (onRowMouseOut) {
a11yProps.onMouseOut = () => onRowMouseOut({ index, rowData })
a11yProps.onMouseOut = (evt) => onRowMouseOut({ evt, index, rowData })
}
if (onRowMouseOver) {
a11yProps.onMouseOver = () => onRowMouseOver({ index, rowData })
a11yProps.onMouseOver = (evt) => onRowMouseOver({ evt, index, rowData })
}
}