inovua / reactdatagrid

Empower Your Data with the best React Data Grid there is
https://reactdatagrid.io
Other
3.44k stars 57 forks source link

MultiSelect doesn't work on click in latest chrome version #71

Closed toninofox closed 3 years ago

toninofox commented 3 years ago

Using the latest Chrome version 89.0.4389.90 on Mac or windows, the Row selection/multiselection doesn't work anymore. The workaround is to use the Checkbox https://reactdatagrid.io/docs/row-selection#multiple-selection-with-checkbox-column but it is not user friendly anymore

Same table worked with older version of chrome or other browsers.

Relevant code or config Reproducible also in the demo page below https://reactdatagrid.io/docs/row-selection#multiple-row-selection

import React, { useState, useCallback } from 'react'

import ReactDataGrid from '@inovua/reactdatagrid-enterprise'
import '@inovua/reactdatagrid-enterprise/index.css'

import people from './people'
import flags from './flags'

const gridStyle = { minHeight: 550 };

const columns = [
  { name: 'id', header: 'Id', defaultVisible: false, defaultWidth: 60, type: 'number' },
  { name: 'name', header: 'Name', defaultFlex: 1 },
  { name: 'country', header: 'Country', defaultFlex: 1,
    render: ({ value })=> flags[value]? flags[value] : value
  },
  { name: 'city', header: 'City', defaultFlex: 1 },
  { name: 'age', header: 'Age', defaultFlex: 1, type: 'number' }
];

const App = () => {
  const [selected, setSelected] = useState(null);

  const onSelectionChange = useCallback(({ selected: selectedMap, data }) => {
    const newSelected = Object.keys(selectedMap).map(id => id * 1)

    setSelected(newSelected);
  }, [])

  return (
    <div>
      <h3>Multiple row selection - uncontrolled</h3>
      <ReactDataGrid
        idProperty="id"
        enableSelection
        multiSelect
        onSelectionChange={onSelectionChange}
        style={gridStyle}
        columns={columns}
        dataSource={people}
      />
      <p>
        Selected rows: {selected == null ? 'none' : JSON.stringify(selected)}.
      </p>
    </div>
  );
}

export default () => <App />

What you did: Trying to click on the row itself. Expecting that the row is marked as selected

What happened: Clicked row is not marked as selected and it is not displayed in the output "Selected Rows: none"

Problem description:

The only way to select a row is using checkbox, which become painful for multiple rows which in the past can be selected holding the Shift key

jruts commented 3 years ago

+1 Have the same issue.

inovua-admin commented 3 years ago

Tested on both Mac and Windows on the latest version of Chrome 89.0.4389.90 and we can't reproduce it.

toninofox commented 3 years ago

https://user-images.githubusercontent.com/8643889/112965379-1d92e500-9141-11eb-99e4-3d2491154363.mov

inovua-admin commented 3 years ago

That example doesn't have multiple selection enabled. You need multiSelect.

toninofox commented 3 years ago

That was just to show not even the single selection works. I can upload another recording of the multiselection but as you can see from the previous, the selected Row output at the bottom is always saying: "None".

i can update the original issue description as it looks like a problem on the SingleSelect as well and not only on the Multiselect

yurigenin commented 3 years ago

I can replicate it every time on Chrome on Mac. The culprit seems to be that mousemove and click events on that version of Chrome do not report the pageX and pageY property values using the same number type. One uses an integer and the other decimal. (See the Watch pane in the top right corner):

image

yurigenin commented 3 years ago

image

inovua-admin commented 3 years ago

Should be fixed in 4.0.34