Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add drag and drop to react-aria-components TabList #7196

Open
vovsemenv opened this issue Oct 15, 2024 · 5 comments
Open

Add drag and drop to react-aria-components TabList #7196

vovsemenv opened this issue Oct 15, 2024 · 5 comments

Comments

@vovsemenv
Copy link

Provide a general summary of the feature here

I see dragAndDropHooks in List but don't see it in TabList

🤔 Expected Behavior?

add dragAndDropHooks={dragAndDropHooks} to TabList

😯 Current Behavior

💁 Possible Solution

No response

🔦 Context

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@vovsemenv vovsemenv changed the title Add drag and drop to rac tabs Add drag and drop to react-aria-components TabList Oct 15, 2024
@snowystinger
Copy link
Member

Unfortunately Tab lists only allow tabs as children and tabs don't allow interactive children
https://w3c.github.io/aria/#tablist

As a result, it's difficult to add an affordance for keyboard users or assistive technology users.

I'm not saying this won't happen eventually, but it won't be as simple as just adding dragAndDropHooks to TabList.

@LFDanLu
Copy link
Member

LFDanLu commented Oct 16, 2024

@majornista we briefly discussed the possibility of using Enter as the keyboard affordance to start a drag session since https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-manual/ has Enter and/or Space to change which tab to display but just wanted to check if you had any opinions on the keyboard experience here.

@ttsirkia
Copy link

ttsirkia commented Nov 1, 2024

Related #5366. It would be very good addition if it was possible to reorder and close tabs by using the tab headers.

I think the keyboard actions could be very similar to GridList.

@devongovett
Copy link
Member

Drag and drop would have to be more like ListBox, not GridList. Like ListBox, Tabs do not allow interactive children within them according to the aria spec. That means we couldn't have a drag button affordance inside them like GridList does. You could potentially trigger drag and drop by pressing Enter on an already selected tab. For the same reason, close buttons can't be supported within Tabs unfortunately.

Another possibility would be to just use GridList styled to look like Tabs instead of the actual Tabs component if they have interactive elements inside them. Not sure that's ideal, but it could be the only valid option until something like the aria-actions proposal is standardized. w3c/aria#1440

@ttsirkia
Copy link

ttsirkia commented Nov 1, 2024

That's actually true that ListBox is a better example here as it doesn't have any visible handle.

It is unfortunate that Aria specs limits the functionality. I didn't try this earlier but noticed that Edge has implemented quite nice keyboard actions:
tabs

You can swap the position of the tabs by using Ctrl+left/right arrow. I couldn't get this working with Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants