Table onRow -> onClick wrongly fired when clicking on the Checkbox (only when unselecting)
Reproduction link
Steps to reproduce
- Open the reproduction sandbox
- Click on a checkbox to select a row
- Click again on the same checkbox to unselect the row
What is expected?
The checkbox should be unselected
What is actually happening?
The checkbox is selected (the only way to unselect the row is to click on the row and not on the checkbox)
| Environment | Info |
|---|---|
| antd | 5.0.1 |
| React | 18.3.0 |
| System | Windows 10 |
| Browser | Chrome |
The bug is happening because the onRow -> onClick is triggered and the rowSelection -> onChange is also triggered.
I would like to work on this issue, please assign it to me
@Pranshu1902 Please feel free to PR on this : )
It seems that the problem is resolved in 5.0.4 Related topic : https://github.com/ant-design/ant-design/pull/39078
In fact, this isn't resolved entirely. There is still a spot that will trigger the 2 events. To reproduce try clicking on the top limit of the checkbox, it won't work...
let me fix this problem.
经过测试antd 5.x 和 antd 4.x 均有此问题
antd@5.3.2 also has this problem.
I changed the rowSelectedKeys array using both the onSelectChange and onRowClick functions. when I click the checkbox border, the two functions fire at the same time.
reproduce link: https://stackblitz.com/edit/react-zqnkhw?file=demo.tsx