Browse Source

fix: check for more keys

pull/8990/head
DarkPhoenix2704 4 months ago
parent
commit
a08d960181
No known key found for this signature in database
GPG Key ID: 3F76B10622A07849
  1. 8
      packages/nc-gui/components/nc/Carousel/index.vue

8
packages/nc-gui/components/nc/Carousel/index.vue

@ -19,16 +19,16 @@ onUnmounted(() => {
})
function onKeyDown(event: KeyboardEvent) {
const prevKey = props.orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'
const nextKey = props.orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'
const prevKey = props.orientation === 'vertical' ? ['ArrowUp', 'Up', 'w', 'W'] : ['ArrowLeft', 'Left', 'a', 'A']
const nextKey = props.orientation === 'vertical' ? ['ArrowDown', 'Down', 's', 'S'] : ['ArrowRight', 'Right', 'd', 'D']
if (event.key === prevKey) {
if (prevKey.includes(event.key)) {
event.preventDefault()
carouselArgs.scrollPrev()
return
}
if (event.key === nextKey) {
if (nextKey.includes(event.key)) {
event.preventDefault()
carouselArgs.scrollNext()
}

Loading…
Cancel
Save