AppFlowy icon indicating copy to clipboard operation
AppFlowy copied to clipboard

[FR] Right click on View Item to open context menu

Open Xazin opened this issue 2 years ago • 5 comments

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

Xazin avatar Aug 07 '23 10:08 Xazin

working on this

dotarjun avatar Aug 08 '23 12:08 dotarjun

Are you still working on this, @dotarjun ?

annieappflowy avatar Nov 05 '23 14:11 annieappflowy

Hey! I'm not working on this

dotarjun avatar Nov 06 '23 15:11 dotarjun

Hi, I'd like to take this on

ax920 avatar Dec 30 '23 02:12 ax920

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 onPointerDown callback, that checks whether the event.buttons is equal to kSecondaryMouseButton, similarly for the left click see kPrimaryMouseButton
  • Now for the showOverlay, it should take an optional Offset?that we can provide in case usePointerPosition is set to true.
  • 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.

Xazin avatar Mar 06 '24 12:03 Xazin