Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(useActiveElement): ignore blur for relatedTarget (#2540)
If a blur event has a `relatedTarget` that element will receive focus. For the short time between blur and focus the `document.activeElement` will be the body element. By ignoring the blur event here we simply wait for the computedWithControl to be triggered by the focus event that will follow as we know. By then the new element will have focus. By doing this we prevent e.g. that stuff will be triggered that depends on the activeElement being inside a specific element. E.g. `useFocusWithin` will profit from this, since the focus will not be reset to `<body>` in between.
- Loading branch information