Skip to content

Commit

Permalink
[DataGrid] Toggle menu on click in GridActionsCell (#15867)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rajat19 authored and arminmeh committed Dec 13, 2024
1 parent 3548ca8 commit f397a8b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/x-data-grid/src/components/cell/GridActionsCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ function GridActionsCell(props: GridActionsCellProps) {
const hideMenu = () => {
setOpen(false);
};
const toggleMenu = () => {
if (open) {
hideMenu();
} else {
showMenu();
}
};

const handleTouchRippleRef =
(index: string | number) => (instance: TouchRippleActions | null) => {
Expand Down Expand Up @@ -213,7 +220,7 @@ function GridActionsCell(props: GridActionsCellProps) {
aria-controls={open ? menuId : undefined}
role="menuitem"
size="small"
onClick={showMenu}
onClick={toggleMenu}
touchRippleRef={handleTouchRippleRef(buttonId)}
tabIndex={focusedButtonIndex === iconButtons.length ? tabIndex : -1}
{...rootProps.slotProps?.baseIconButton}
Expand Down

0 comments on commit f397a8b

Please sign in to comment.