From 5a23723f2ccddb7e4f24aa90d7a40705a747b472 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Mon, 29 Oct 2018 16:44:50 +0100 Subject: [PATCH] Explore: fix copy/paste on table cells When selecting text via mouse, our ReactTable cells' click handler triggers an event. - check event target to be the link, only then handle the event --- public/app/features/explore/Table.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/app/features/explore/Table.tsx b/public/app/features/explore/Table.tsx index 0264bd3b4cc..4946a6a505d 100644 --- a/public/app/features/explore/Table.tsx +++ b/public/app/features/explore/Table.tsx @@ -21,10 +21,16 @@ function prepareRows(rows, columnNames) { export default class Table extends PureComponent { getCellProps = (state, rowInfo, column) => { return { - onClick: () => { - const columnKey = column.Header; - const rowValue = rowInfo.row[columnKey]; - this.props.onClickCell(columnKey, rowValue); + onClick: (e: React.SyntheticEvent) => { + // Only handle click on link, not the cell + if (e.target) { + const link = e.target as HTMLElement; + if (link.className === 'link') { + const columnKey = column.Header; + const rowValue = rowInfo.row[columnKey]; + this.props.onClickCell(columnKey, rowValue); + } + } }, }; };