From e7470c3e8f1d65d2480eb1eafba7963f627cbd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=81=D0=B5=D0=BD=D0=B8=D1=8F?= <31247233+kseniya57@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:29:50 +0300 Subject: [PATCH] fix(DropdownMenu): remove required path from DropdownMenuItemProps, fix navigation (#567) Co-authored-by: kseniyakuzina --- src/components/DropdownMenu/DropdownMenuItem.tsx | 2 +- src/components/utils/useListNavigation/useListNavigation.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/DropdownMenu/DropdownMenuItem.tsx b/src/components/DropdownMenu/DropdownMenuItem.tsx index de34a87cee..aa5c155622 100644 --- a/src/components/DropdownMenu/DropdownMenuItem.tsx +++ b/src/components/DropdownMenu/DropdownMenuItem.tsx @@ -13,7 +13,7 @@ import {cnDropdownMenu} from './DropdownMenu.classname'; import {DropdownMenuPopup} from './DropdownMenuPopup'; import {DropdownMenuContext} from './DropdownMenuContext'; -export type DropdownMenuItemProps = DropdownMenuListItem & { +export type DropdownMenuItemProps = Omit, 'path'> & { popupProps?: Partial; closeMenu?: () => void; children?: ReactNode; diff --git a/src/components/utils/useListNavigation/useListNavigation.ts b/src/components/utils/useListNavigation/useListNavigation.ts index 3eccbc8ea9..4eaafc1a66 100644 --- a/src/components/utils/useListNavigation/useListNavigation.ts +++ b/src/components/utils/useListNavigation/useListNavigation.ts @@ -43,6 +43,11 @@ export function useListNavigation({ return; } + const canNavigate = items.some((item) => !skip?.(item)); + if (!canNavigate) { + return; + } + const anchor = anchorRef?.current; if (!anchor) { return;