-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Separate Menu and ListBox into different components #254
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
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
| slots={{ | ||
| text: styles['spectrum-Menu-itemLabel'], | ||
| icon: styles['spectrum-Menu-icon'], | ||
| description: styles['spectrum-Menu-description'] | ||
| }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's a bug in the story. The end and keyboard slots were removed from listbox intentionally after talking to design. Will be fixed in my next PR.
LFDanLu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the one change mentioned above, looks fine to me
|
Build successful! 🎉 |

This splits Menu into two components: Menu (as used with MenuTrigger), and ListBox (used inside Picker, ComboBox, etc.). The components have slightly different usecases and accessibility requirements, so this makes sense. The differences between them are:
role=menuwithrole=menuitem,role=menuitemradio, orrole=menuitemcheckboxfor its items whereas ListBox usesrole=listboxwithrole=optionfor its items.aria-multiselectablewhereas Menu does not.aria-checkedwhereas ListBox items usearia-selectedThe DOM structure changed for sections to be heirarchical, using a
role="group"with anaria-labelledbypointing at the heading. This is implemented in Menu so far, but ListBox is pending changes to collection view to support this.A
useSelectableListhook has been added that wrapsuseSelectableCollectionand adds a default keyboard handler for non-virtualized lists. It uses the DOM to get layout information (e.g. for implementing page up/page down support). When non-virtualized, adata-keyattribute is added to each item, so that DOM nodes can be found by their key.In addition, keyboard navigation now skips disabled items.
aria-posinsetandaria-setsizehave been added to items when virtualized.