Buttons are built as div
s.
I would like to create the following behavior:
- When user clicks on the button, a dialog appears.
- Then, if user clicks anywhere else on the page, the dialog disappears.
I'm struggling to implement the second requirement.
I tried to use hasFocus
on div
s, but it doesn't seem to work. Looks like hasFocus
works on input elements like input
, button
, etc.
How would you implement the desired behavior?