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

Context menus #4

Open
1j01 opened this issue Mar 8, 2020 · 0 comments
Open

Context menus #4

1j01 opened this issue Mar 8, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@1j01
Copy link
Owner

1j01 commented Mar 8, 2020

Expose an API for context menus, using the same menu code as menubar popups.

The function needs to take a menu definition, a position, and orientation (directions it should fly out).

Something like:

popupMenu({
  menu: contextMenu,
  from: {x: event.clientX, y: event.clientY}, // {x, y} (or Event?), or DOMRect (or Element) so it can pop from different spots according to which direction it ends up popping  
  direction: "down right", // preferred direction - may flip or reposition to fit within bounds
  repositionWithinBounds: DOMRect or Element or false, // defaults to page viewport (taking into account scrollbars); false forces the direction you specify to apply
})

Can look at other menu APIs for inspiration/validation.

@1j01 1j01 added the enhancement New feature or request label Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant