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

[Feature Request]: Improve ContextMenu to provide a safe triangle area #13271

Closed
1 task done
tay1orjones opened this issue Mar 1, 2023 · 2 comments
Closed
1 task done
Labels
component: context-menu proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡

Comments

@tay1orjones
Copy link
Member

tay1orjones commented Mar 1, 2023

The problem

When using ContextMenu with submenus via mouse, a user must keep their pointer strictly on the item selected to navigate to the submenu. See here attempting to select the last option "Company"

can.t.reach.the.last.option.mov

The solution

The problem is in sharp contrast to how a user would navigate to items within the list. Instead ContextMenu should take into account a 'safe triangle area' to where the existing submenu stays open even when the pointer is not directly on the selected item or the submenu.

Examples

Here's an example from this excellent article:

ideal.safe.triangle.mp4

This approach was initially popularized by Amazon with their megamenu back in 2013: https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown/amp

Application/PAL

No response

Business priority

None

Available extra resources

No response

Code of Conduct

@tay1orjones
Copy link
Member Author

tay1orjones commented Mar 3, 2023

Great example here: https://floating-ui.com/docs/usehover#safepolygon

It feels like encapsulating this into a hook could make a lot of sense. The root logic though should be vanilla javascript functions so that other framework variants (Svelte, Web Components, etc.) can reuse it. This base logic could then be composed into a hook for ease of use.

Other nested menu components could then take advantage of the hook, such as in #3764

@sstrubberg sstrubberg added the proposal: accepted This request has gone through triaging and we are accepting PR's against it. label Sep 25, 2023
@tay1orjones
Copy link
Member Author

Fixed via #16466 though the solution was a simple timeout instead of this calculation idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: context-menu proposal: accepted This request has gone through triaging and we are accepting PR's against it. type: enhancement 💡
Projects
Archived in project
Development

No branches or pull requests

2 participants