adobe / adobe/react-spectrum

RAC Table: Click on the column to cycle sort in ascending/descending/none

Open
#9,375 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the feature here

Currently, clicking on a column only cycles the sorting in ascending/descending order. We should add an option to include none (`sortDescriptor = null`) in the cycle.

### 🤔 Expected Behavior?

https://mui.com/x/react-data-grid/sorting/

https://github.com/user-attachments/assets/d0b7adfd-26ce-43d1-b0bb-8cbdf38bb8e6

### 😯 Current Behavior

https://react-aria.adobe.com/Table#sorting

https://github.com/user-attachments/assets/4dbb5897-11d3-4d83-9436-36aa234ca6d2

### 💁 Possible Solution

```ts
allowsUnsorted?: boolean;
sortDescriptor?: SortDescriptor | null;
onSortChange?: (sortDescriptor: SortDescriptor | null) => void;
```

### 🔦 Context

https://mui.com/x/react-data-grid/sorting/
https://www.ag-grid.com/javascript-data-grid/row-sorting/
https://tanstack.com/table/latest/docs/framework/react/examples/sorting?panel=sandbox

### 💻 Examples

_No response_

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.