vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Feature Request] Keyboard control for left and right arrow in v-carousel components

Open IsabelMeraner opened this issue 5 years ago • 1 comments

Problem to solve

It would be nice to have the possibility to control the v-carousel component and walk through the slides using the left and right arrow keys without having to use the mouse.

see example from the docs:
https://codepen.io/pen/?&editable=true&editors=101=https%3A%2F%2Fvuetifyjs.com%2Fen%2Fcomponents%2Fcarousels%2F

Proposed solution

If I see it right, a keydown event is only triggered after clicking on an opened v-carousel component, eg. if it is embedded in a v-dialog component. Is there any workaround for this at the moment to control the component using the left/right arrow keys right away?

As a workaround the key events for the left and right arrow keys need to be registered and handled on the parent component, eg. something like this to navigate left and right and keep track of the index in the gallery:

<v-dialog v-model="showCarousel" @keydown.right="navigate('right', images.length-1)" @keydown.left="navigate('left', images.length-1)" >

Any ideas or better workarounds for this?

IsabelMeraner avatar Jun 02 '20 15:06 IsabelMeraner

Just a comment to think about the case when there are several carousels on the same page. Maybe a focus indicator would be helpful.

djcaesar9114 avatar Jan 06 '23 14:01 djcaesar9114