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

Iframe events are not working #52

Open
oanamun opened this issue Nov 5, 2020 · 1 comment
Open

Iframe events are not working #52

oanamun opened this issue Nov 5, 2020 · 1 comment

Comments

@oanamun
Copy link

oanamun commented Nov 5, 2020

I am sending to the keybindings function an iframe body reference and the events are not fired.
I found out this is because of this check if (!(event instanceof KeyboardEvent)) { return }.
From what I read on MDN, instanceof doesn't work as expected when used between different contexts, such as different frames, because they have different execution environments so even the KeyboardEvent type is considered different.

@ionutpasca
Copy link

Instead of if (!(event instanceof KeyboardEvent)) { return }, a check on the constructor name can be done -> if (event.constructor.name !== 'KeyboardEvent') { return }

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

No branches or pull requests

2 participants