Issues using ng-keyboard-shortcuts-help component
charlierudolph opened this issue · comments
Charlie Rudolph commented
Describe the bug
Trying to make use of the help component I ran into a couple issues related to showing lines for the open / close help keys.
- Appears closeKeyLabel is not working as expected. Looking at the code appears this line https://github.com/omridevk/ng-keyboard-shortcuts/blob/10.1.17/projects/ng-keyboard-shortcuts/src/lib/ng-keyboard-shortcuts-help.component.ts#L209 needs to be updated to pass the label instead of the description.
- The current implementation requires the the description / label attributes be defined first in order for them to work. This appears to be due to how the shortcut is added on the input value change vs an ngOnInit / ngOnChanges
Examples:
The following usage
<ng-keyboard-shortcuts-help
key="?"
keyDescription="Show this help menu"
keyLabel="General"
closeKey="escape"
closeKeyDescription="Hide this help menu"
closeKeyLabel="General"
title="Keyboard shortcuts">
The following usage
<ng-keyboard-shortcuts-help
keyDescription="Show this help menu"
keyLabel="General"
key="?"
closeKeyDescription="Hide this help menu"
closeKeyLabel="General"
closeKey="escape"
title="Keyboard shortcuts">
results in
Expected behavior:
closeKeyLabel should work as documented and order of attributes should not be required for it to work.
Version Info:
Angular 9, Chrome browser
Omri commented
fixed.
Charlie Rudolph commented
Thanks!