mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 15:01:40 -05:00
hide tooltip when button menu is opened (#13247)
GitOrigin-RevId: 1b6c1b09477dc9435996f3e190a72eb1a6c1d5cf
This commit is contained in:
parent
a05c201652
commit
61e7f6f3a8
2 changed files with 8 additions and 1 deletions
|
@ -69,6 +69,7 @@ export const ToolbarButtonMenu: FC<{
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
hidden={open}
|
||||||
id={id}
|
id={id}
|
||||||
description={<div>{label}</div>}
|
description={<div>{label}</div>}
|
||||||
overlayProps={{ placement: 'bottom' }}
|
overlayProps={{ placement: 'bottom' }}
|
||||||
|
|
|
@ -15,6 +15,7 @@ export type TooltipProps = {
|
||||||
id: string
|
id: string
|
||||||
overlayProps?: OverlayProps
|
overlayProps?: OverlayProps
|
||||||
tooltipProps?: BSTooltip.TooltipProps
|
tooltipProps?: BSTooltip.TooltipProps
|
||||||
|
hidden?: boolean
|
||||||
children: React.ReactElement
|
children: React.ReactElement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ function Tooltip({
|
||||||
children,
|
children,
|
||||||
tooltipProps,
|
tooltipProps,
|
||||||
overlayProps,
|
overlayProps,
|
||||||
|
hidden,
|
||||||
}: TooltipProps) {
|
}: TooltipProps) {
|
||||||
const hideTooltip = (e: React.MouseEvent) => {
|
const hideTooltip = (e: React.MouseEvent) => {
|
||||||
if (e.currentTarget instanceof HTMLElement) {
|
if (e.currentTarget instanceof HTMLElement) {
|
||||||
|
@ -34,7 +36,11 @@ function Tooltip({
|
||||||
return (
|
return (
|
||||||
<OverlayTrigger
|
<OverlayTrigger
|
||||||
overlay={
|
overlay={
|
||||||
<BSTooltip id={`${id}-tooltip`} {...tooltipProps}>
|
<BSTooltip
|
||||||
|
id={`${id}-tooltip`}
|
||||||
|
{...tooltipProps}
|
||||||
|
style={{ display: hidden ? 'none' : 'block' }}
|
||||||
|
>
|
||||||
{description}
|
{description}
|
||||||
</BSTooltip>
|
</BSTooltip>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue