diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 8a988ce363..cdb2f3145b 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -4,6 +4,7 @@ import {Ellipsis} from '@gravity-ui/icons'; import _memoize from 'lodash/memoize'; import {useUniqId} from '../../../../hooks'; +import {useBoolean} from '../../../../hooks/private'; import type {PopperPlacement} from '../../../../hooks/private'; import {Button} from '../../../Button'; import {Icon} from '../../../Icon'; @@ -112,7 +113,7 @@ const DefaultRowActions = ({ rowActionsSize, isRowDisabled, }: DefaultRowActionsProps) => { - const [open, setOpen] = React.useState(false); + const [isPopupOpen, , closePopup, togglePopup] = useBoolean(false); const anchorRef = React.useRef(null); const rowId = useUniqId(); @@ -137,6 +138,8 @@ const DefaultRowActions = ({ onClick={(event) => { event.stopPropagation(); handler(item, index, event); + + closePopup(); }} iconStart={icon} className={menuItemCn} @@ -158,10 +161,10 @@ const DefaultRowActions = ({ return (
setOpen(false)} + onOutsideClick={closePopup} id={rowId} > @@ -171,13 +174,13 @@ const DefaultRowActions = ({