diff --git a/frontend/src/components/controls/Tooltip.tsx b/frontend/src/components/controls/Tooltip.tsx index 35f50a02..937af624 100644 --- a/frontend/src/components/controls/Tooltip.tsx +++ b/frontend/src/components/controls/Tooltip.tsx @@ -3,6 +3,7 @@ import RcTooltip from 'rc-tooltip'; type TooltipProps = { title: string, + identifier?: string; placement?: 'left' | 'right' | 'top' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight', children: ReactElement, mouseEnterDelay?: number; @@ -13,8 +14,9 @@ type TooltipProps = { // --> The user can craft a malicious script with the NotesModalButton and this will just execute it! -export const Tooltip = ({children, title, placement = 'left', mouseEnterDelay = 0.6}: TooltipProps) => ( +export const Tooltip = ({children, title, placement = 'left', mouseEnterDelay = 0.6, identifier = ''}: TooltipProps) => ( } diff --git a/frontend/src/components/controls/form-controls/Button.tsx b/frontend/src/components/controls/form-controls/Button.tsx index 0cb44690..23b76948 100644 --- a/frontend/src/components/controls/form-controls/Button.tsx +++ b/frontend/src/components/controls/form-controls/Button.tsx @@ -51,16 +51,35 @@ const ButtonComponent = ({variant = 'primary', size = 'md', disabled, className, if (disabled) { // WORKAROUND: Tooltip not going away when the button is disabled // https://github.com/react-component/tooltip/issues/18#issuecomment-411476678 + const identifier = Math.floor(Math.random() * Date.now()).toString(36) FinalButton = ( - +
{ + const tooltips = document.getElementsByClassName(identifier); + for(let i = 0; i < tooltips.length; i++) + { + tooltips[i].classList.add("rc-tooltip-hidden"); + } + }} + onPointerEnter={()=>{ + const tooltips = document.getElementsByClassName(identifier); + for(let i = 0; i < tooltips.length; i++) + { + tooltips[i].classList.remove("rc-tooltip-hidden"); + } + }} {...rest} > {icon ? : null}