brtnshrdr / angular2-hotkeys

Keyboard shortcuts for Angular 2 apps
MIT License
203 stars 95 forks source link

It's this module Firefox compatible? #91

Closed LuisReinoso closed 6 years ago

LuisReinoso commented 6 years ago

I tested in google chrome and it's ok but in firefox not working. Are there any way to solve this.

Google chrome: 68.0.3432.3 Firefox: 59.0.2 (64-bits)

wittlock commented 6 years ago

It is most certainly Firefox compatible, but the browsers sometimes behave slightly different with more complex hotkeys (multiple modifiers like shift+ctrl+s). Could you post the hotkey that's not working for you (replace the callback with a console.log or something) and I'll try to take a look, although I have some travel coming up which will greatly limit my ability to debug issues.

LuisReinoso commented 6 years ago

I try the modifier 'meta + 1' and 'ctrl + 1' and replace with console.log but nothing happens. Not trigger in firefox, in chrome is ok.


this.hotkeysService.add(
      new Hotkey(
        'meta+1',
        (event: KeyboardEvent): boolean => {
          console.log('meta+1');
          return false; // Prevent bubbling
        }, ['INPUT'], 'Print meta+1'
      )
    );
wittlock commented 6 years ago

Due to travels I'm not able to dig deeper into this at the moment, and it will be a few weeks before I can. But I suspect your problem stems from the key combination you picked. Firefox has a built in hotkey for swapping between tabs (Ctrl + 1 through Ctrl + 8) and it's very much possible that it hijacks that before the webpage gets a chance to. So you might need to use a different combination and see if that works better.

If that's not a solution or still doesn't work I'll dig into it deeper once I'm done traveling.

wittlock commented 6 years ago

Since I haven't heard back I'll assume it was the Firefox built-in hotkeys causing issues. Feel free to comment to reopen the issue if it needs further assistance.

LuisReinoso commented 6 years ago

@wittlock Sorry I didn't see this message.

Ok, in this web page are all firefox's keyboard shortcuts

In this way, hotkey 'meta + 1' it's a good candidate to be a hotkey beacuse is not a firefox's keyboard shortcut.