iTwin / iTwinUI

A design system for building beautiful and well-working web interfaces.
https://itwin.github.io/iTwinUI/
MIT License
107 stars 38 forks source link

Context/right-click menu #2157

Open GerardasB opened 3 months ago

GerardasB commented 3 months ago

Feature

AppUI team is deprecating ContextMenu from @itwin/core-react storybook This component was regularly used to render an action list and can be usually replaced by an iTwinUI DropdownMenu i.e. saved views widget: Screenshot 2024-07-23 at 15 05 14

Another use-case is when the menu is used as a contextual/right-click menu. Then it must be positioned without an explicitly visible target (i.e. following cursor), which DropdownMenu currently doesn't support out-of-the-box. For this use case, we had a separate component GlobalContextMenu.

Examples

Here's an example of how it could work with current iTwinUI components: stackblitz. Feature-wise the context menu is very similar to the DropdownMenu since it usually contains actions and can be nested.

mayank99 commented 3 months ago

Hey @GerardasB, can you clarify the first use-case? The menu in your screenshot looks like a regular DropdownMenu, since it is triggered by a regular button.

GerardasB commented 3 months ago

Hey @GerardasB, can you clarify the first use-case? The menu in your screenshot looks like a regular DropdownMenu, since it is triggered by a regular button.

Yes, that's just one of the use cases of how our current ContextMenu component was used and it should be replaced by iTwinUI DropdownMenu. We should focus on addressing the use case when there is no trigger.

MartynasStrazdas commented 20 hours ago

Hi, we recently removed GlobalContextMenu and implemented Gerardas workaround using a dropdown menu. Are there any updates or plans to support a right-click-based dropdown menu or possible adjustments to the existing dropdown menu? @mayank99