fgr-araujo / vue-shortkey

Vue-ShortKey - The ultimate shortcut plugin to improve the UX
MIT License
889 stars 101 forks source link

Error in directive shortkey unbind hook: "TypeError: i[r] is undefined" #115

Open pSnehanshu opened 4 years ago

pSnehanshu commented 4 years ago

I have some shortcuts defined on a vue page. Like this

<div
    v-shortkey="{ undo: ['ctrl', 'z'], redo: ['ctrl', 'y'], redo2: ['ctrl', 'shift', 'z'] }"
    @shortkey="handleKeyboardShortcuts"
  >

Whenever I navigate away from that page, I get the following error message in the console.

In firefox: [Vue warn]: Error in directive shortkey unbind hook: "TypeError: i[r] is undefined"

In chrome: [Vue warn]: Error in directive shortkey unbind hook: "TypeError: Cannot read property 'el' of undefined"

Both of them point to this script as the source of the error: webpack:///node_modules/vue-shortkey/dist/index.js?3717

This hasn't caused any unintended side-effects, but still, I would love to know the cause of this.

svamja commented 4 years ago

Same here.

[Vue warn]: Error in directive shortkey unbind hook: "TypeError: Cannot read property 'el' of undefined"

This happens, when one navigates using vue router from one component to other component, which does not have the same shortcut keys.

Is there a better approach to avoid getting this error?

And, thank you @iFgR for this wonderful plugin. Keyboard shortcuts are close to a developer's heart!

fgr-araujo commented 4 years ago

Thank you @svamja! I'm so glad to know that you like it!

pSnehanshu commented 4 years ago

What's the wontfix label?

fgr-araujo commented 4 years ago

Fix needed

rick-lansink commented 4 years ago

Any progress on this issue?