react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Support for reordering Tabs by dragging

Open ttsirkia opened this issue 2 years ago โ€ข 6 comments

Provide a general summary of the feature here

Currently reordering of tabs in Tab component is not possible although many drag&drop features already exist for other components (such as GridList). Could it be possible to add an option to allow dragging for tabs?

๐Ÿค” Expected Behavior?

If the reordering of tabs is allowed, you could start dragging the tab header and select its new position. Just like the browser tabs in Chrome, for example.

๐Ÿ˜ฏ Current Behavior

This behavior is not supported.

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

There are several use cases in which there are some documents opened by user etc. which are shown as tabs. User might like to reorganize the order of the tabs by dragging the tab headers as you can do for browser tabs, for example.

๐Ÿ’ป Examples

No response

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

ttsirkia avatar Nov 05 '23 11:11 ttsirkia

I'm not sure how we'd do that. Tabs Aria does not allow for interactive elements inside tabs, so we couldn't place a drag button in them, so we'd need some other way to make it keyboard and VoiceOver accessible.

We can ask our accessibility team and see if anyone has ideas there. Or if you have any, feel free to add them here.

For now it might be easiest to use a dialog, then represent the order of the tabs in there with a GridList that allows dragging. When the dialog is closed, the tabs reorder.

snowystinger avatar Nov 05 '23 20:11 snowystinger

This is an example of the behavior https://ctxhou.github.io/react-tabtab/#draggable but by looking the HTML I guess it contains aria info only for the typical tab details, not about the dragging.

Using a specific dialog to reorder is of course one workaround for this but not that simple to use.

ttsirkia avatar Nov 05 '23 20:11 ttsirkia

BTW, would that restrict also adding a close button to a tab header if all interactive elements are against aria specifications?

ttsirkia avatar Nov 05 '23 20:11 ttsirkia

I understand the concept. However, I cannot keyboard navigate to the tab lists in any of those examples. I don't think we should use those as examples to base our own implementation on. If there isn't prior work out there which supports all the input modes, then we'll need to see if we can come up with anything.

Correct, you cannot place a close button inside a Tab. See https://w3c.github.io/aria/#tab

Children Presentational: True

snowystinger avatar Nov 05 '23 20:11 snowystinger

+1 Required functionality. Any update?

opflucker avatar Nov 07 '25 08:11 opflucker

No updates at this time, the aria pattern limitation still needs a solution.

snowystinger avatar Nov 09 '25 21:11 snowystinger