diff --git a/react/features/base/ui/components/web/ContextMenuItem.tsx b/react/features/base/ui/components/web/ContextMenuItem.tsx index 6dfe873b2..50e925230 100644 --- a/react/features/base/ui/components/web/ContextMenuItem.tsx +++ b/react/features/base/ui/components/web/ContextMenuItem.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from 'react'; +import React, { ReactNode, useCallback } from 'react'; import { useSelector } from 'react-redux'; import { makeStyles } from 'tss-react/mui'; @@ -179,6 +179,18 @@ const ContextMenuItem = ({ const { classes: styles, cx } = useStyles(); const _overflowDrawer: boolean = useSelector(showOverflowDrawer); + const onKeyPressHandler = useCallback(e => { + // only trigger the fallback behavior (onClick) if we dont have any explicit keyboard event handler + if (onClick && !onKeyPress && !onKeyDown && (e.key === 'Enter' || e.key === ' ')) { + e.preventDefault(); + onClick(e); + } + + if (onKeyPress) { + onKeyPress(e); + } + }, [ onClick, onKeyPress, onKeyDown ]); + return (