My goal is to replicate the functionality typeform (see question #2) provides with their keyboard friendly forms. I want to generate a list of potential answers to my question using v-for (easy) and assign each of them a keycode which binds a letter to each button (possible?).
I have two problems:
Is it possible to assign a keycode to a list using v-for? (I can't predict the amount of possible answers to a question, it could be anywhere from 2+.)
None of the following attempts work:
@keydown.:button.key
:@keydown.button.key
@keydown.{{button.key}}
- How do you make this keydown functionality work globally? The only way it works right now is if you tab to the button so it's currently in focus and then press the key which is hardcoded.
Fiddle: https://jsfiddle.net/ffgvw3yr/5/