[FR] Right click on View Item to open context menu
Description
Currently on a navigation item, only when hovering the popover button to show the context menu shows, and you can only open it by clicking the button (:).
We should refactor this so that it becomes possible to right-click anywhere on the navigation item to open the context menu.
The context menu opened with right-click should open relative to mouse.
Impact
UX
Additional Context
No response
working on this
Are you still working on this, @dotarjun ?
Hey! I'm not working on this
Hi, I'd like to take this on
In case this is going to be picked up at some point, here is some information on the preferred solution:
- Enabling Secondary Click as a Popover Trigger
- Implementing a boolean on whether the Offset should adhere to the pointers offset on trigger, or if it should adhere to child. Eg.
usePointerPosition- It should default to false so it doesn't break existing Popovers. - In the Listener used to track whether a click happens, we can make a check inside the
onPointerDowncallback, that checks whether theevent.buttonsis equal to kSecondaryMouseButton, similarly for the left click see kPrimaryMouseButton - Now for the
showOverlay, it should take an optionalOffset?that we can provide in caseusePointerPositionis set totrue. - Also the math for deciding where to display the Popover based on the PopoverDirection, should be different for when using the Pointer Offset, otherwise the popover will show up in odd locations.
There might also be some issues when wrapping the ViewItem in the new AppFlowyPopover, because of the rebuild that occurs if you hover over a non-selected item, and then trigger a popover which effectively removes the hover effect causing a rebuild. The rebuild should be blocked from occuring, by eg. setting resetHoverOnRebuild to false (on the FlowyHover ancestor) in case the Popover is being opened.