Keyboard (arrows) navigation for answers #193
Answered
by
spinn
Miguelklappes
asked this question in
Ideas
-
Basically, the title :D |
Beta Was this translation helpful? Give feedback.
Answered by
spinn
Jul 1, 2021
Replies: 2 comments 1 reply
-
@Miguelklappes, thanks for the suggestion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Miguelklappes Although Flow Form doesn't implement this natively, we added a few new API functions which would allow you to do this manually/externally: <template>
<flow-form
ref="flowform"
v-bind:questions="questions"
v-bind:standalone="true"
>
</flow-form>
</template>
<script>
export default {
name: 'example',
components: {
FlowForm
},
data() {
return {
questions: [
...
]
}
},
mounted() {
document.addEventListener('keyup', this.onKeyUpListener, true)
},
beforeUnmount() {
document.removeEventListener('keyup', this.onKeyUpListener, true)
},
methods: {
onKeyUpListener(e) {
if (e.key === 'ArrowDown') {
this.$refs.flowform.goToNextQuestion()
} else if (e.key === 'ArrowUp') {
this.$refs.flowform.goToPreviousQuestion()
}
}
}
}
</script> We'll also add this internally as well with a configurable option in a future update. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
EkaterinaVu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Miguelklappes Although Flow Form doesn't implement this natively, we added a few new API functions which would allow you to do this manually/externally: