Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useActiveElement): ignore blur for relatedTarget #2540

Commits on Dec 13, 2022

  1. fix(useActiveElement): ignore blur for relatedTarget

    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.
    dpschen committed Dec 13, 2022
    Copy the full SHA
    850efa3 View commit details
    Browse the repository at this point in the history