Skip to content

Commit

Permalink
fix: only add tabIndex when keyboardControls enabled (#984)
Browse files Browse the repository at this point in the history
* fix: only add tabIndex when keyboardControls enabled

* fix: tabIndex changes from review; changeset info
  • Loading branch information
parkersweb authored Nov 15, 2022
1 parent 43da1cd commit 0ba2520
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/few-dodos-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nuka-carousel': patch
---

slider-frame is no longer a focus target if enableKeyboardControls is false
2 changes: 1 addition & 1 deletion packages/nuka/src/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export const Carousel = (rawProps: CarouselProps): React.ReactElement => {
}}
aria-label={frameAriaLabel}
role="region"
tabIndex={0}
tabIndex={enableKeyboardControls ? 0 : -1}
onKeyDown={enableKeyboardControls ? onKeyDown : undefined}
ref={carouselRef}
onMouseUp={onMouseUp}
Expand Down

1 comment on commit 0ba2520

@vercel
Copy link

@vercel vercel bot commented on 0ba2520 Nov 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.