carbon-design-system / carbon-for-ibm-dotcom

Carbon for IBM.com is based on the Carbon Design System for IBM
https://www.ibm.com/standards/carbon/
Apache License 2.0
262 stars 156 forks source link

[data-table]: radio buttons should not include `check all` option and selecting individual rows does not trigger toolbar #11667

Open kennylam opened 5 months ago

kennylam commented 5 months ago

Description

When radio buttons are used, the check all option should not be available as only one per group is selectable. Additionally, selecting radio buttons does not activate the table toolbar.

image (1)

image (2)

Component(s) impacted

data-table

Browser

Chrome, Safari, Firefox, Microsoft Edge

Carbon for IBM.com version

v2.5.0

Severity

Severity 2 = Aspects of design is broken, and impedes users in a significant way, but there is a way to complete their tasks. Affects major functionality, has a workaround.

Application/website

@carbon/web-components

Package

@carbon/web-components

CodeSandbox example

https://web-components.carbondesignsystem.com/?path=/story/components-datatable-selection--with-radio-selection

Steps to reproduce the issue (if applicable)

No response

Release date (if applicable)

No response

Code of Conduct

sangeethababu9223 commented 5 months ago

Table toolbar is needed only when we are choosing multiple rows and with radio button we can only choose one row at a time, hence the batch action toolbar is not needed here. The same behaviour can be seen in the carbon/react data table also with radio button option.

The select all option is now being hidden with hide-checkbox attribute added manually to the element in storybook, this can be updated if needed.

dave-wood commented 1 month ago

I've just had this same problem again (I think Kenny created this issue based on what I reported on the slack channel) and I think this still needs more work.

With regards to the above comment, firstly, yes you can add hide-checkbox to the table header row to prevent the "bug" of it allowing multiple radio buttons to be checked - but that is a workaround not a fix, you shouldn't need the user to do that. By default the select all checkbox should NOT appear if you are using the radio button option here.

Secondly, I disagree that the batch action buttons are not required if you are only selecting 1 item in the table. I need this feature all the time. I have a table of items, I want the user to select the radio button for a row and an action button should then appear allowing the user to Edit or Delete the item. Yes, a single item.

Because the batch action buttons don't appear when you use radio buttons, then I'm going to be forced to use checkboxes, and code the extra check to make sure the user has only checked 1 row. Surely it's not too much to ask to have the batch action buttons appear with radio! It would make my life easier.

These 2 items have been outstanding for months now - would it be possible to get this looked at? Thanks.