ng-keyboard-shortcuts
ng-keyboard-shortcuts copied to clipboard
Unable to use browser shortcuts
Describe the bug
Hi
I use a shortcut on c
key, the linked command is very simple : just navigate on a specific url. The problem is that when I tried to use a copy (Command|CTLR + C), this shortcut is fired and my application navigate to this url, and my clipboard stay empty :'(
Is it a way to use « c » as a shortcut and keep the possibility to keep copy/paste behavior ?
{
key: ['c'],
label: 'Global shortcuts',
description: 'Open my custom page',
preventDefault: true,
command: () => this._router.navigate([‘/my_url', ‘page'])
}
It's the same if I defined a shortcut on s
or q
key. the corresponding "command + S" (save) and "command + q" (quit) are unusable.
@zannkukai This seems like a bug. I'll look into this weekend. i'll try to think of a workaround in the meantime.
Thank you for reporting the issue 👍
@zannkukai Can you please specify what is your desired behavior in this case? since you put preventDefault on the event, it won't cause copy and paste, can you try and remove the preventDefault? or set it to false? Thank y oiu Please re-open if the issue persist.
@omridevk
If i set preventDefault:false
, I can use the "copy" (my clipboard is filled). Thanks for this trick.
But the main problem is that when I used cmd+c
(copy) the shortcut defined on c
is still fired.
So in my previous example, I will navigate to '/my_url/page' when I would just copy some text in my clipboard.
PS : I doesn't have any option to re-open this issue
sorry wasn't aware that you can't re-open, I re-opened it :)
@zannkukai Okay I see your point, and it is a valid one, I'll try to think of a solution for that. Will keep you posted, hopefully I'll get to it rather sooner than later.
fixed in versions: 10.1.13, 9.1.13 and 7.1.13 Let me know if the issue persist. Thank you again for reporting the bug
@zannkukai Should be that if you registered a command with one key, if any of modifiers are clicked as well, the event will not fire. only when no modifiers are clicked, the event will fire. I assume this is the behavior you expected, correct?
If you enjoy the library, please give it a Star up :) Don't have to of course
@zannkukai Should be that if you registered a command with one key, if any of modifiers are clicked as well, the event will not fire. only when no modifiers are clicked, the event will fire. I assume this is the behavior you expected, correct?
That's right 👍 Thanks for your quick feedback and solution.
the fix I made seems to cause a small regression, hopefully i'll fix it soon otherwise I might have to revert until I find a proper fix. I will try to solve it later on today, if not by this weekend.
You will say i'm a "tricky man" but now I can't use the key associated with the "shift" command :'(
By example, on my french keyboard, to type a '?' character, I need to push on "shift + ," (shift + comma)
So now, I can't use the character "?" to open the shortcuts help panel :'(
yes I am aware that's the regression I was referring to. I will try to solve it today.
Not tricky man :) valid complaints, it was my bad for merging the code without verifying this basic regression test. I still have not had the time to write some tests to ease modifying the code. if by EOD I won't have a valid solution I will revert. In the meantime, if you decide the new issue is problematic, feel free to downgrade to previous version until I release a new one. Thanks again and sorry for the issues.
@zannkukai Please let me know if the issue persist and i'll re-open though I did make sure to verify all the various working scenarios and your newly reported bug were working properly. I'll re-open if it still there. And thank you for the patience 💯
It's almost perfect. I had still one problem : I use a shortcut ?
to open the panel and a shortcut /
to place focus on my main search box. As /
is the revert of ?
(https://github.com/omridevk/ng-keyboard-shortcuts/pull/88/files#diff-8d9297a8b0f0b9d3d25a47313ad05bbbR118). The action performed is the same when I click on both keys. On my belgian azerty keyboard, both keys characters are not present on the same key (see screenshot above).
At this time to solve my problem, I will change the /
key to use another one.
But if you still has the strength to work on this very small issue, it will be wonderfull. don't know how to solve this issue without having any keyboard template mapping.
Not nit picking at all, you expected it to work and it should. I'll do my best to resolve all these issues, again your feedback is very welcome :)
Forgive me if this might take a bit longer to fix, i am a bit busy in work related stuff in the upcoming week/s
@zannkukai wish we had only one layout :P Hopefully i'll find a more general solution as I wrote a big TODO there as I really do not like the complexity added there which is really hard to follow and is very bug pruned. I'll install your layout and play around with it. And i'll try to think of a way to test all these keyboards layout automatically, thus reducing regressions like these.
Can you let me know how important this bug affects your current application? I mean can I have some sometime to think of a more generic and bullet-proof solution? Thank you :)
Not "really" important. Our application is still under development and shortcuts can wait a little bit. For me it's always more interesting to have a generic solution ;-) Thanks for time you passed on our problem.
Hi @omridevk. Did you have any feedback about this problem ? I will have a planning meeting about our project in a couple of days and this topic will be addressed. Thx
Sorry I am a bit busy due to personal reasons, hopefully I'll get to it soon enough. Again sorry the inconvenience