omridevk / ng-keyboard-shortcuts

Dead Simple Keyboard Shortcuts Management for Angular

Home Page:https://ng-keyboard-shortcuts.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues using ng-keyboard-shortcuts-help component

charlierudolph opened this issue · comments

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.

  1. 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.
  2. 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">

results in
shortcuts_not_working

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

shortcuts_hide_is_off

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

commented

fixed.

Thanks!