carbon-addons-iot-react
carbon-addons-iot-react copied to clipboard
[Table] callback issues when single select with Radio buttons props are set
What package is this for?
- [x] React
- [ ] Angular
Describe the bug
There are two defects surrounding the single select behavior with radio buttons.
- On line 252 of
TableBodyRow.jsxwe are callingonRowSelectedinside anonChangeevent for theTableCell. We are also calling theonRowSelectedwhen theRadioButtoelement is clicked on line 265. We should only be calling this once. You can see this in our storybook here. Make sureoptions.hasRowSelectionis set to 'single' and theoptions.useRadioButtonSingleSelectoptions is clicked in the 'Selections and actions' knob tab. Then open the actions panel and click on the radio button. You will see the callback fired twice. - With the same story and knobs active try clicking on the row in an area outside of the radio button cell with the actions tab open. You will see that an
onRowSelectedand anonRowClickedcallback are fired. Notice that the radio button does not show a selected state. This most likely stems to when we added the radio buttons for single selection. Previously, a user could click anywhere and it would select the row. @JordanWSmith15 @dianatran18 can you chime in with whether we should continue to allow the clicking on a row to fire theonRowSelectedand update the radio button accordingly or disallow row clicks to fire theonRowSelectedwhen we are using radio buttons?
@JordanWSmith15 This is related to the defect being worked by Tom for Graphite.
To Reproduce
Steps to reproduce the behavior:
- Go to this story
- Got to the 'Selections and actions' knob tab in the knob pannel.
- Make sure
options.hasRowSelectionis set to 'single' and theoptions.useRadioButtonSingleSelectoptions is clicked - Open the actions panel
- Click on the radio button in the table
- See the action firing twice.
- Click anywhere in the row and see the
onRowSelectedcallback being fired.
We will want to make sure that our behavior for single select without the radio buttons and the multi-select functionality is preserved.
Codecov Report
Base: 63.92% // Head: 63.92% // No change to project coverage :thumbsup:
Coverage data is based on head (
becf8bb) compared to base (4bea68e). Patch has no changes to coverable lines.
Additional details and impacted files
@@ Coverage Diff @@
## master #2075 +/- ##
=======================================
Coverage 63.92% 63.92%
=======================================
Files 73 73
Lines 6398 6398
=======================================
Hits 4090 4090
Misses 2308 2308
| Flag | Coverage Δ | |
|---|---|---|
| pytest | 63.92% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.