Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

Improve context menu handling in resource-manager

Open valadas opened this issue 1 year ago • 2 comments

The resource-manager context menus are currently driven by some convoluted logic to fire events from one so others can catch those events to close themselves. At the time, my attention was not totally focused on thinking we would have them in different contexts and this causes some odd behaviours in some sequence of clicks.

There is a super simple way though to make this both simple and more robust, when basically any click outside a context menu just closes it... The code would look something like this:

@Listen('mousedown', { target: 'document' })
  handleOutsideClick(event: MouseEvent) {
    const path = event.composedPath();
    if (!path.includes(this.el)) {
      this.closeDropdownMenu();
    }
  }

valadas avatar Jan 27 '23 23:01 valadas