carbon-design-system / ibm-products

A Carbon-powered React component library for IBM Products
https://carbon-for-ibm-products.netlify.app/
Apache License 2.0
83 stars 116 forks source link

[Feature Request]: Provide Shift-click segment selection for Datagrid #4990

Open crichtonibm opened 2 weeks ago

crichtonibm commented 2 weeks ago

The problem

The Selectable Row feature provides a Select All capability, but does not support the "standard" shift-click method of selecting a swath of rows at once.

The solution

Update the Selectable Row feature to support Shift-selection of a checkbox to set/reset all checkboxes between the previous checkbox toggled (normally without shift) and the current checkbox.

If row 1 is toggled normally, it becomes the primary row. Then, if row 5 is shift-toggled, the result would be rows 1 through 5 all being either selected or deselected, depending on the current state of the entire set. If 1-5 were already all selected when the shift-select of 5 occurred, then they will all be deselected. If ANY of the 1-5 was already in the deselected state, then all would be selected.

The primary row should only be changed when a normal (no shift) selection occurs. In the above example, we shift-selected row 5. Lets say they are now all selected. If I shift-click row 6, I would expect the segment to be 1-6, not 5-6, as 1 was still the primary row.

If there is no primary row, then a shift-select is treated as a non-shifted select, and it will select the primary row.

If the primary row is removed from the table, then it is as though there never was a primary row selected (so a shift select will be treated as a non-shift select)

Design link

No response

Links to other materials

No response

Owner/main maintainer(s)

Joe Crichton (requestor)

Second/backup maintainer(s)

No response

Product/offering

No response

Business priority

None

Code of Conduct