hzdg / hz-core

HZ's internal library of React Components 🚧
https://hz-core.netlify.com
0 stars 0 forks source link

Extract useClickOutsideCallback hook from 2U #44

Open lettertwo opened 4 years ago

lettertwo commented 4 years ago

Is your feature request related to a problem? Please describe.

UIs that present 'modal' or 'popover' behavior often overlook an important UX element—dismissing the overlay UI when the user tries to access the UI behind it.

2U has a hook that takes an element ref, and a callback, and then calls that callback whenever a click is detected outside of the element. This could be a building block for modal behaviors—a simple solution for an important detail that is easy to overlook.

Describe the solution you'd like

Extract and package useClickOutsideCallback from 2U

Describe alternatives you've considered

🤔

Additional context