chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 254 forks source link

iframe binding issue #288

Open gauravlodha opened 5 years ago

gauravlodha commented 5 years ago

My page loads under iframe tag and when focus goes on iframe or I click on the iframe, my shortcut combo does not work and if I click on the document or body or elsewhere except iframe my shortcut combo works smoothly. Please help me on this issue how do I resolve this? How do I bind hotkeys to iframe?

aramando commented 5 years ago

So the Angular application, including the hotkeys stuff, is loaded inside an iframe, but it's only when the iframe does NOT have focus that the shortcuts work? That seems like the opposite of what I would expect.

See this issue

gauravlodha commented 5 years ago

No not whole angular application only page like a book page loads under iframe but other things like button, panel are loads outside iframe.

aramando commented 5 years ago

OK, then the problem you have is pretty much exactly as described in the issue I linked to. It's not easy to fix, but if you want to try there are a couple of suggestions from the author of Mousetrap, the underlying library that angular-hotkeys uses. The easiest thing might be to stop using iframes, though, if possible, because they're always going to greatly complicate Javascript applications due to their security restrictions.