adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.88k stars 1.12k forks source link

SelectionGroup component for Menu to support more than one selection modes. #1621

Open intergalacticspacehighway opened 3 years ago

intergalacticspacehighway commented 3 years ago

๐Ÿ™‹ Feature Request

SelectionGroup component will allow putting selection mode on groups. This is a fairly common use-case. See the screenshot attached in examples - there are 2 groups, one has a "single" selection mode and the other has "none".

๐Ÿค” Expected Behavior

A single menu component should support more than one selection mode.

๐Ÿ˜ฏ Current Behavior

Currently, selection mode can be specified only on the Menu component.

๐Ÿ’ Possible Solution

๐Ÿ”ฆ Context

Have discussed this with @devongovett and we found this is a fairly common use case.

๐Ÿ’ป Examples

Screenshot 2021-02-23 at 10 27 13 AM

๐Ÿงข Your Company/Team

GeekyAnts

GeekyAnts/NativeBase

๐ŸŽ Tracking Ticket (optional)

cmmartti commented 3 years ago

Here are two more examples of mixed selection modes in a single menu in the wild. The first is on the Windows desktop, the second is in the Window menu of most document-oriented desktop programs:

mixed-selection-modes

mixed-selection-modes_adobe-acrobat

intergalacticspacehighway commented 3 years ago

Got something working! If Items aren't wrapped with a SelectionGroup, it'll fallback to Menu's selectionMode

https://user-images.githubusercontent.com/23293248/112585266-7ef44480-8e1f-11eb-8ef0-5ef4cc8f2dcc.mov

devongovett commented 3 years ago

@intergalacticspacehighway are you still working on this? If not, is your code in a place where someone else could take it over?

intergalacticspacehighway commented 3 years ago

@devongovett I lost the code with my old system ๐Ÿ˜ญ I can reimplement and create a PR by this weekend though.

intergalacticspacehighway commented 3 years ago

@devongovett created a draft PR https://github.com/adobe/react-spectrum/pull/2091. It's a bit rough right now, I've added some comments.

ritz078 commented 11 months ago

Is this in the roadmap in the near future?