Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Fire event on window blur if page is visible #32

Closed
DanielKucal opened this issue Feb 24, 2018 · 2 comments
Closed

Fire event on window blur if page is visible #32

DanielKucal opened this issue Feb 24, 2018 · 2 comments

Comments

@DanielKucal
Copy link
Contributor

DanielKucal commented Feb 24, 2018

If our page contains an iframe and user clicks on it - it is outside click, but web browser doesn't emit proper event due to security reasons. It would be great to have a work-around for it. I suggest to listen to window blur event and emit outside click event if page is visible like in the following example:

    window.addEventListener('blur', () => {
        setTimeout(() => {
            if (!document.hidden) {
                console.log('outside click event');
            }
        });
    });

Let me know what you think, so I will prepare PR.

@DanielKucal
Copy link
Contributor Author

@arkon, could you have a look at this topic?

@arkon
Copy link
Owner

arkon commented Apr 1, 2018

Sounds reasonable. An option called [emitOnBlur] or something would make sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants