hotkeys-js icon indicating copy to clipboard operation
hotkeys-js copied to clipboard

Not triggering when focus in on Input

Open frankagr94 opened this issue 5 years ago • 5 comments

Hi, I have an issue, when I try to trigger the shortcut on an input focused, this does not work, I have to click on background page to get the shortcut working properly. Can you help me with this?

frankagr94 avatar Sep 19 '19 14:09 frankagr94

@frankagr94

This example may be what you want. https://codepen.io/jaywcjlove/pen/OJLaXaw

jaywcjlove avatar Sep 19 '19 16:09 jaywcjlove

Hi, I have an issue, when I try to trigger the shortcut on an input focused, this does not work, I have to click on background page to get the shortcut working properly. Can you help me with this?

You can read in docs: "By default hotkeys are not enabled for INPUT SELECT TEXTAREA elements.".

I missed that too 😅

hotkeys.filter = function(event){
  return true;
}

mariovalney avatar Sep 06 '21 16:09 mariovalney

Can we apply this filter per hotkey? because it seems to be global only atm.

adi518 avatar Nov 16 '21 16:11 adi518

Can we apply this filter per hotkey? because it seems to be global only atm.

after checkout the sourcecode, I think it is a global hook, and how can I to listening command+s even if an <input /> element was focus on but skip command+z

javaxiu avatar Aug 04 '22 06:08 javaxiu

Can we apply this filter per hotkey? because it seems to be global only atm.

Maybe checking the data about the hotkey in event? Or hotkeys.getScope();?

I'm not able to reproduce it now, but I'm pretty sure it's possible.

mariovalney avatar Aug 04 '22 13:08 mariovalney