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

Keybindings override #33

Closed
dadyarri opened this issue Jan 15, 2022 · 11 comments
Closed

Keybindings override #33

dadyarri opened this issue Jan 15, 2022 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@dadyarri
Copy link

If current tab has actions on keyboard (like escape key in telegram web) it overrides action in Omni, and Omni does not closing

@sr2echa
Copy link
Contributor

sr2echa commented Jan 15, 2022

If current tab has actions on keyboard (like escape key in telegram web) it overrides action in Omni, and Omni does not closing

Bro, just click outside the menu
It will exit

@dadyarri
Copy link
Author

dadyarri commented Jan 15, 2022

Bro, just click outside the menu

I know, but there should be way to do it without mouse in that case

@sr2echa
Copy link
Contributor

sr2echa commented Jan 16, 2022

Bro, just click outside the menu

I know, but there should be way to do it without mouse in that case

type something that gives 0 results [like hhhhhhhhhhhhhhh] and press enter

@alyssaxuu
Copy link
Owner

I've been looking into this and honestly I haven't found a solution. I see on Telegram it requires pressing the Esc key two times to work, it can certainly be a bit annoying. Unsure if I can do anything about it, I considered making the Esc key an "official" command, but if you had an extension that was also using it that would cause issues. Would be interested to see if anyone knows how this could work - I'm assuming it's due to some event.stopPropagation() call?

@alyssaxuu alyssaxuu added the help wanted Extra attention is needed label Jan 16, 2022
@sr2echa
Copy link
Contributor

sr2echa commented Jan 16, 2022

I've been looking into this and honestly I haven't found a solution. I see on Telegram it requires pressing the Esc key two times to work, it can certainly be a bit annoying. Unsure if I can do anything about it, I considered making the Esc key an "official" command, but if you had an extension that was also using it that would cause issues. Would be interested to see if anyone knows how this could work - I'm assuming it's due to some event.stopPropagation() call?

making an close Omni command will do right?

@alyssaxuu
Copy link
Owner

I've been looking into this and honestly I haven't found a solution. I see on Telegram it requires pressing the Esc key two times to work, it can certainly be a bit annoying. Unsure if I can do anything about it, I considered making the Esc key an "official" command, but if you had an extension that was also using it that would cause issues. Would be interested to see if anyone knows how this could work - I'm assuming it's due to some event.stopPropagation() call?

making an close Omni command will do right?

Yes, closeOmni() makes the omnisearch close, the problem is how to make it trigger on the Esc key when Telegram seems to prevent it from propagating.

@sr2echa
Copy link
Contributor

sr2echa commented Jan 16, 2022

Wont making an action close Omni that will call closeOmni() be acceptable?

@sr2echa
Copy link
Contributor

sr2echa commented Jan 16, 2022

Or better, why not inject overide-hotkeys.js to the webpage while initiating omni ?

@alyssaxuu
Copy link
Owner

Wont making an action close Omni that will call closeOmni() be acceptable?

No, there are many ways to close Omni already (clicking outside the omnisearch, pressing Esc, and pressing on the extension icon), and they all should work.

Or better, why not inject overide-hotkeys.js to the webpage while initiating omni ?

This wouldn't solve anything, the keypress event would still not propagate.

@sr2echa
Copy link
Contributor

sr2echa commented Jan 16, 2022

overide-hotkeys.js

onkeydown = function(e){
  if(e.escKey.charCodeAt(0)){
    e.preventDefault();
  }
}

ig this would work

@alyssaxuu
Copy link
Owner

onkeydown = function(e){
  if(e.escKey.charCodeAt(0)){
    e.preventDefault();
  }
}

Doesn't quite work, I ended up doing a different thing though and managed to fix it. A bit weird but basically listening for the keyup event outside jQuery did work, so I used that and then closed it through there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants