diff --git a/webapp/platform/components/src/tour_tip/tour_tip.tsx b/webapp/platform/components/src/tour_tip/tour_tip.tsx index 4e85e53acf..7f2509bb15 100644 --- a/webapp/platform/components/src/tour_tip/tour_tip.tsx +++ b/webapp/platform/components/src/tour_tip/tour_tip.tsx @@ -1,13 +1,14 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React, {useRef} from 'react'; +import React, {useRef, useState} from 'react'; import {FormattedMessage} from 'react-intl'; import Tippy from '@tippyjs/react'; import {Placement} from 'tippy.js'; import classNames from 'classnames'; import {PunchOutCoordsHeightAndWidth} from '../common/hooks/useMeasurePunchouts'; +import {useClickOutsideRef} from '../common/hooks/useClickOutsideRef'; import 'tippy.js/dist/tippy.css'; import 'tippy.js/themes/light-border.css'; @@ -89,12 +90,15 @@ export const TourTip = ({ }: Props) => { const FIRST_STEP_INDEX = 0; const triggerRef = useRef(null); + const [useBackdrop, setUseBackdrop] = useState(!hideBackdrop); const onJump = (event: React.MouseEvent, jumpToStep: number) => { - if (handleJump) { - handleJump(event, jumpToStep); - } + handleJump?.(event, jumpToStep); }; + useClickOutsideRef(triggerRef, () => { + setUseBackdrop(false); + }); + // This needs to be changed if root-portal node isn't available to maybe body const rootPortal = document.getElementById('root-portal'); @@ -210,7 +214,7 @@ export const TourTip = ({ > - + />} {show && (