primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Datatable: Row and Checkbox Selection causes event bubbling and disables cell text copying

Open m-ivanova opened this issue 4 years ago • 5 comments

When the selection option "Checkbox-Only Selection" is used in the datatable, I am unable to copy the text from the cells in the table and also when triggering the onRowClick event from the datatable the checkbox gets focused. I do believe that maybe in the background the row itself gets selected that causes problems related to event bubbling as well.

I'm submitting a ... (check one with "x")

[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports) Please fork the codesandbox below and create a case demonstrating your bug report. Issues without a codesandbox have much less possibility to be reviewed.

PLEASE USE THE Example given in the Primereact DEMO Examples. https://www.primefaces.org/primereact/showcase/#/datatable/selection

Scroll to Row and Checkbox Selection

Current behavior Use "Checkbox-Only Selection" in the Datatable component and try to click on the row(for example to copy the text from on of the cells), the checkbox gets focused. When trying to remove the selection from the table, the issue does not exist.

Expected behavior To remove the focus from the checkbox and maybe remove selecting the row in the background(if this is what is happening)

Minimal reproduction of the problem with instructions Steps are described above in "Current behaviour"

Please tell us about your environment: Windows,Visual Studio Code, npm

  • React version: 17.0.1

  • PrimeReact version: 6.4.1

  • Browser: Firefox

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

m-ivanova avatar Dec 09 '21 08:12 m-ivanova

Hi,

I couldn't replicate this issue. Could you please attach a video or gif for us?

Best Regards,

mertsincan avatar Dec 13 '21 07:12 mertsincan

Hi,

attach you will find the recording. I am using Firefox and the demo components from your page. https://user-images.githubusercontent.com/35693852/145977799-06a437fa-8d77-4f96-a270-32e95e1894df.mp4

m-ivanova avatar Dec 14 '21 10:12 m-ivanova

Hi,

Thanks a lot for the video! Did you try it with Chrome? Maybe, this issue can be related to FF.

mertsincan avatar Dec 14 '21 12:12 mertsincan

Hello,

I did try, but I need this to be working in Firefox as well. And whenever I have a horizontal scroll in the datatable I am unable to copy the text whenever the scroll is not at the beginning of the table, because the checkbox gets focused and it is positioned in the beginning of the table. The conclusion that the issue comes from the checkbox selection came from the fact that whenever I remove the selection from the table , all works as intended.

m-ivanova avatar Dec 16 '21 12:12 m-ivanova

Fixed in https://github.com/primefaces/primereact/issues/2575

Please try selectionAutoFocus={false} on 7.1.1

Best Regards,

mertsincan avatar Jan 14 '22 07:01 mertsincan