Skip to content

Commit

Permalink
fix(useListNavigation): remove navigation with right and left arrows
Browse files Browse the repository at this point in the history
  • Loading branch information
kseniyakuzina committed Jul 14, 2023
1 parent fe05925 commit 7bc6fd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/utils/useListNavigation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

React hook used to navigate through the items in a list

`ArrowDown`, `ArrowRight` will increase currently active item index
`ArrowUp`, `ArrowLeft` will reduce currently active item index
`ArrowDown` will increase currently active item index
`ArrowUp` will reduce currently active item index
`PageDown` will increase currently active item index by pageSize (works if `pageSize` passed)
`PageUp` will reduce currently active item index by pageSize (works if `pageSize` passed)
`Home` will navigate to the start of the list if `processHomeKey` (disable if you want to move the cursor to the start of active input on `Home` key, for example)
Expand Down
6 changes: 2 additions & 4 deletions src/components/utils/useListNavigation/useListNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export function useListNavigation<ItemType, AnchorType extends HTMLElement>({
}

switch (event.key) {
case 'ArrowDown':
case 'ArrowRight': {
case 'ArrowDown': {
event.preventDefault();

// Go 1 step forward
Expand All @@ -71,8 +70,7 @@ export function useListNavigation<ItemType, AnchorType extends HTMLElement>({

break;
}
case 'ArrowUp':
case 'ArrowLeft': {
case 'ArrowUp': {
event.preventDefault();

// Go 1 step back
Expand Down

0 comments on commit 7bc6fd6

Please sign in to comment.