Skip to content

afeiship/next-hotkey-focus

Repository files navigation

next-hotkey-focus

Manage elements focus by hotkey.

version license size download

installation

npm install -S @jswork/next-hotkey-focus

usage

import '@jswork/next-hotkey-focus';

// Make sure selector elements are loaded.
window.addEventListener("DOMContentLoaded", () => {
  nx.hotkeyFocus({
    keys: ['cmd + k'], 
    selectors: ['input[data-hotkey-focus]'],
    callback: (e) => {
      console.log('focued!');
    }
  })
})

license

Code released under the MIT license.