From 338961480c687ea7892b14a7f05fe15a08cd27ef Mon Sep 17 00:00:00 2001 From: = Date: Tue, 14 Jan 2025 21:46:17 +0530 Subject: [PATCH] feat: resolved accessibility issue with menu --- frontend/src/components/v2/Menu/Menu.tsx | 62 +++++++++++------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/frontend/src/components/v2/Menu/Menu.tsx b/frontend/src/components/v2/Menu/Menu.tsx index 29076af18..ea9643eb0 100644 --- a/frontend/src/components/v2/Menu/Menu.tsx +++ b/frontend/src/components/v2/Menu/Menu.tsx @@ -30,7 +30,7 @@ export const MenuItem = ({ className, isDisabled, isSelected, - as: Item = "button", + as: Item = "div", description, // wrapping in forward ref with generic component causes the loss of ts definitions on props inputRef, @@ -38,46 +38,40 @@ export const MenuItem = ({ }: MenuItemProps & ComponentPropsWithRef): JSX.Element => { const iconRef = useRef(null); return ( -
  • iconRef.current?.play()} - onMouseLeave={() => iconRef.current?.stop()} + iconRef.current?.play()} + onMouseLeave={() => iconRef.current?.stop()} + {...props} > - - -
    + {icon && ( +
    + { + iconRef.current = el; + }} + src={`/lotties/${icon}.json`} + loop + className="h-full w-full" /> - {icon && ( -
    - { - iconRef.current = el; - }} - src={`/lotties/${icon}.json`} - loop - className="h-full w-full" - /> -
    - )} - {children} - - {description && {description}} - -
  • + + )} + {children} + {description && {description}} + ); };