ithaka / pharos

JSTOR's design system
https://pharos.jstor.org
MIT License
119 stars 15 forks source link

Popover / DropdownMenu: Make click handling more friendly to consumers #747

Open daneah opened 5 months ago

daneah commented 5 months ago

The problem

Popovers and dropdowns currently listen for clicks and determine whether the click target is within the body of the component to see if the component should close.

The mechanism these components use to do this cause consumers grief when they also have more complex click-handling scenarios, such that they need to use stopPropagations or preventDefaults to get things working. It would be ideal to ease this burden so they aren't putting bandaids on top of bandaids.

The solution

Perform click target detection in a more collaborative manner.