Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "regions" so hotkeys can only be triggered when elements within a region have focus #87

Open
Soviut opened this issue Aug 11, 2019 · 1 comment

Comments

@Soviut
Copy link
Contributor

Soviut commented Aug 11, 2019

Imagine you have several lists, each one with an "Add Item" button. You want a hotkey for each list to trigger the addItem() method. The problem is, hotkeys are global, so which list would have an item added to it?

This could be solved by the ability to define "regions". If any child elements within a region have focus, the hotkey will be localized. So in our list example, only when a list has focus would the hotkey create a new item for that specific list.

<div v-shortkey-region="someRegion">
  <input v-for="item in items" type="text" v-model="...">
  <button @v-shortkey="['ctrl' + 'alt' + 'n']" v-shortkey-parent-region="someRegion">Add Item</button>
</div>

Consider this an extremely rough proposal. Naming conventions, syntax and implementation are all just for demonstration purposes.

@fgr-araujo
Copy link
Owner

It's really good idea!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants