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

[Overlay] Close Active-Overlay on right mouse click or contextmenu event #1559

Closed
spdev3000 opened this issue Jun 22, 2021 · 4 comments · Fixed by #1754
Closed

[Overlay] Close Active-Overlay on right mouse click or contextmenu event #1559

spdev3000 opened this issue Jun 22, 2021 · 4 comments · Fixed by #1754

Comments

@spdev3000
Copy link
Collaborator

Expected Behaviour

When an active overlay is open the user can (left) click outside the popover content to close it while a right mouse click (or contextmenu event) would not close the overlay.

Actual Behaviour

Right mouse click outside popover content doesn't trigger the active overlay to close.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

MacOS, Chrome V91

Sample Code that illustrates the problem

Logs taken while reproducing problem

@Westbrook
Copy link
Contributor

Steps:

  1. User activates an overlay.
  2. User right clicks somewhere.
  3. You expect that to close the overlay?

Can you share some expanded use cases here? I'm not sure that's a default functionality that we want to add. It may be that this needs to be a configuration option, or we need to outline how to do this easily in user space, but I can't quite tell from the information currently available.

@spdev3000
Copy link
Collaborator Author

Yes, our use case is a @contextmenu event triggers a contextmenu to render via an VirtualTrigger:

    const fragment = document.createDocumentFragment()
    fragment.appendChild(contextMenuContent)

    openOverlay(event.target as HTMLElement, 'modal', contextMenuContent, {
      receivesFocus: 'auto',
      virtualTrigger: new VirtualTrigger(event.clientX, event.clientY),
    })

If we then right click outside the menu this overlay should be closed and another menu should be triggered.
Yes, maybe there is some configuration option that enables closing also via right mouse click or @contextmenu event from the active-overlay.

@Westbrook
Copy link
Contributor

Looking into this a bit closer, and want some information on step 3 above. Is closing an Overlay enough? As I build up some test contexts to develop against, it seems like the desire in the context of a contextmenu + VirtualTrigger would be to not just close the Overlay but also to throw a subsequent context menu. See this experience when you right click on the right side of this comment to open a context menu and then while it is open you click on the left side of the comment to open a new context menu in a that location closing the first.

Closing on right click, and only when it's not in the Overlay content, is relatively straight forward, but there's a good bit more infrastructure to get subsequent context menus to open...

@daskruegge
Copy link

@Westbrook The optimal behaviour would be to open a subsequent menu on the second right-click, like you said. But as a short term improvement I would also appreciate just closing the previous overlay on an outside right-click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants