Investigate using event capturing for GlOutsideDirective
The GlOutsideDirective
relies on events bubbling up to the document
in order to detect where the click was targetted. This has a couple of drawbacks:
- If any element between the target and the document stops the event, the directive cannot detect it.
- There are timing-related issues that require workarounds, because browsers execute microtasks during event propagation.
Switching to relying on the capturing phase of events will certainly fix the first problem, and may help with the second.
Additionally, we should consider extending the directive to support other events, like focusin
.
Edited by Mark Florian