I have got a button which when clicked produces a number of child elements, I want to create a “collapse if the user clicks anywhere other than one of the child buttons” effect. To do this, I want to attach a
(click) = xyz() to the whole page, but only have that active if the button has been expanded. Then I would position the child elements infront of the page wide selector (with css z-index). Is it possible to achieve that, or is there a better way of doing that?
Here is what I have so far (only toggles from the button click).