You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use left and right arrow keys to prevent it from working for the convenience of my application.
maybe embla-carousel does not seem to work with left and right arrow keys, so I think this is because there is some control on the shadcn-ui side, but how can I prevent it from working with left and right arrow keys?
sample code
The following is part of the code of the carousel component acquired with shadcn-ui.
consthandleKeyDown=React.useCallback((event: React.KeyboardEvent<HTMLDivElement>)=>{if(event.key==="ArrowLeft"){event.preventDefault();scrollPrev();}elseif(event.key==="ArrowRight"){event.preventDefault();scrollNext();}},[scrollPrev,scrollNext],);...return(<CarouselContext.Providervalue={{carouselRef,api: api,opts,orientation:
orientation||(opts?.axis==="y" ? "vertical" : "horizontal"),scrollPrev,scrollNext,canScrollPrev,canScrollNext,}}><sectionref={ref}// look this 👀// onKeyDownCapture={handleKeyDown} // I thought I disabled keyboard operation, but for some reason it is not disabled.className={cn("relative",className)}aria-roledescription="carousel"{...props}>{children}</section></CarouselContext.Provider>);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
want
I want to use left and right arrow keys to prevent it from working for the convenience of my application.
maybe embla-carousel does not seem to work with left and right arrow keys, so I think this is because there is some control on the shadcn-ui side, but how can I prevent it from working with left and right arrow keys?
sample code
The following is part of the code of the carousel component acquired with shadcn-ui.
Beta Was this translation helpful? Give feedback.
All reactions