praetorian-inc / chariot-ui

Chariot Offensive Security Platform
https://preview.chariot.praetorian.com
MIT License
15 stars 6 forks source link

Dashboard widget dropdown menu overlapping #148

Closed peter-kwan closed 6 days ago

peter-kwan commented 1 week ago

Steps to Reproduce the bug

  1. Open the dropdown for "Select resource"
  2. Select, say, "Seeds"
  3. Open the dropdown for "Select widget"
  4. Decide that I want to select Assets instead. Click open the dropdown for "Select resource".
  5. The resources menu is behind the widget menu.

Expected Behavior When I click the Resource menu when the widget menu is open, the widget menu should get closed.

Screenshots

https://github.com/praetorian-inc/chariot-ui/assets/17729960/5a02da18-f552-4f11-8460-d04d74032080

storbeck commented 1 week ago

"If I say I don't want it, I mouse out, doesn't close" - Peter Kwan

This is the real issue, we need to add a click-away handler on our Menu/Dropdown component (not sure which one) to close the menu when we lose focus on the parent element.

If "Select resource" is open, and we click anywhere besides in the open dropdown, the dropdown should close as the user has indicated they are no longer interested and their focus is elsewhere.