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

feat: generalize menu component #8169

Merged
merged 17 commits into from
May 19, 2021

Conversation

janhassel
Copy link
Member

@janhassel janhassel commented Mar 23, 2021

This PR refactors the currently experimental ContextMenu component and generalizes it to the Menu component which in turn is used to create context menus as well as a more advanced OverflowMenu (to support single- and multi-select as well as nesting).

The context menu is simply a hook now (useContextMenu).

This PR adds a new OverflowMenu implementation which is nothing more than the trigger icon and logic to open the menu. All additional logic such as keyboard navigation, edge detection and accessibility markup is handled by the Menu component.

Intended children for the new OverflowMenu are the same MenuItem, SelectableMenuItem, MenuGroup, MenuRadioGroup and MenuDivider that are used to build context menus.

The new OverflowMenu sits behind a feature flag since the underlying menu component is still considered experimental and there is no feature parity between the old/current OverflowMenu and this one.
Right now, it just uses the enable-2021-release flag. Should it instead use a separate flag?

With the menu being a more general component, teams could use it for more menu-related areas (like an app menu bar or the entries in the UI shell) while keeping a consistent (and accessible) experience with other Carbon menus.

Changelog

New

  • Added new OverflowMenu component under feature flag (enable-2021-release).

Changed

  • Renamed most of ContextMenu into Menu
  • Restructured the unstable_Menu stories

More information

Both, the context menu and the new OverflowMenu stories are grouped under the "unstable_Menu" entry in the storybook.

@netlify
Copy link

netlify bot commented Mar 23, 2021

Deploy Preview for carbon-elements ready!

Built with commit 528f525

https://deploy-preview-8169--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Mar 23, 2021

Deploy Preview for carbon-components-react ready!

Built without sensitive environment variables with commit 528f525

https://deploy-preview-8169--carbon-components-react.netlify.app

@janhassel janhassel marked this pull request as ready for review April 19, 2021 11:28
@janhassel janhassel requested review from a team as code owners April 19, 2021 11:28
@tw15egan tw15egan requested review from a team and jeanservaas and removed request for a team April 26, 2021 20:45
@tw15egan tw15egan requested review from laurenmrice and removed request for jeanservaas April 26, 2021 20:46
@kodiakhq kodiakhq bot merged commit 39393f7 into carbon-design-system:main May 19, 2021
@janhassel janhassel deleted the menu-component branch May 19, 2021 08:08
@jnm2377 jnm2377 mentioned this pull request May 24, 2021
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants