hide tooltip when button menu is opened (#13247)

GitOrigin-RevId: 1b6c1b09477dc9435996f3e190a72eb1a6c1d5cf
This commit is contained in:
Domagoj Kriskovic 2023-05-31 10:04:42 +02:00 committed by Copybot
parent a05c201652
commit 61e7f6f3a8
2 changed files with 8 additions and 1 deletions

View file

@ -69,6 +69,7 @@ export const ToolbarButtonMenu: FC<{
return (
<>
<Tooltip
hidden={open}
id={id}
description={<div>{label}</div>}
overlayProps={{ placement: 'bottom' }}

View file

@ -15,6 +15,7 @@ export type TooltipProps = {
id: string
overlayProps?: OverlayProps
tooltipProps?: BSTooltip.TooltipProps
hidden?: boolean
children: React.ReactElement
}
@ -24,6 +25,7 @@ function Tooltip({
children,
tooltipProps,
overlayProps,
hidden,
}: TooltipProps) {
const hideTooltip = (e: React.MouseEvent) => {
if (e.currentTarget instanceof HTMLElement) {
@ -34,7 +36,11 @@ function Tooltip({
return (
<OverlayTrigger
overlay={
<BSTooltip id={`${id}-tooltip`} {...tooltipProps}>
<BSTooltip
id={`${id}-tooltip`}
{...tooltipProps}
style={{ display: hidden ? 'none' : 'block' }}
>
{description}
</BSTooltip>
}