Skip to content

Commit 5e594ad

Browse files
refactor: Display tooltip on cancel action (#4421)
1 parent eefc26c commit 5e594ad

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

site/src/components/DropdownButton/ActionCtas.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Tooltip from "@material-ui/core/Tooltip"
12
import Button from "@material-ui/core/Button"
23
import { makeStyles } from "@material-ui/core/styles"
34
import BlockIcon from "@material-ui/icons/Block"
@@ -73,12 +74,19 @@ export const CancelButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({ han
7374

7475
// this is an icon button, so it's important to include an aria label
7576
return (
76-
<WorkspaceActionButton
77-
icon={<BlockIcon />}
78-
onClick={handleAction}
79-
className={styles.cancelButton}
80-
ariaLabel="cancel action"
81-
/>
77+
<div>
78+
<Tooltip title="Cancel action">
79+
{/* We had to wrap the button to make it work with the tooltip. */}
80+
<div>
81+
<WorkspaceActionButton
82+
icon={<BlockIcon />}
83+
onClick={handleAction}
84+
className={styles.cancelButton}
85+
ariaLabel="cancel action"
86+
/>
87+
</div>
88+
</Tooltip>
89+
</div>
8290
)
8391
}
8492

0 commit comments

Comments
 (0)