Skip to content

Commit

Permalink
fix(button): remove tooltip on click on button in and tooltip icon (#…
Browse files Browse the repository at this point in the history
…9882)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
Alessandra Davila and kodiakhq[bot] committed Oct 21, 2021
1 parent a9c13ff commit 4a95fb7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const Button = React.forwardRef(function Button(

const handleClick = (evt) => {
// Prevent clicks on the tooltip from triggering the button click event
setAllowTooltipVisibility(false);
if (evt.target === tooltipRef.current) {
evt.preventDefault();
return;
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/TooltipIcon/TooltipIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const TooltipIcon = ({
};

const handleClick = (evt) => {
setAllowTooltipVisibility(false);
// Prevent clicks on the tooltip from triggering the button click event
if (evt.target === tooltipRef.current) {
evt.preventDefault();
Expand Down

0 comments on commit 4a95fb7

Please sign in to comment.