Skip to content

Commit

Permalink
Use a <button>
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek committed May 19, 2023
1 parent 08d9a35 commit 94342d0
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions components/dashboard/src/components/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,17 @@ function ContextMenu(props: ContextMenuProps) {

return (
<div className="relative">
<div
className="cursor-pointer"
<button
title="Expand actions menu"
className="cursor-pointer reset"
onClick={() => {
toggleExpanded();
// Don't use `e.stopPropagation();` because that prevents that clicks on other context menus closes this one.
setSkipClickHandler(true);
}}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
toggleExpanded();
setSkipClickHandler(true);
}
}}
tabIndex={0}
>
{children}
</div>
</button>
{expanded ? (
<div
className={`mt-2 z-50 bg-white dark:bg-gray-900 absolute flex flex-col border border-gray-200 dark:border-gray-800 rounded-lg truncated ${
Expand Down

0 comments on commit 94342d0

Please sign in to comment.