From efc7f8c5e9741862c3f19b26a990c5daa1e9520e Mon Sep 17 00:00:00 2001 From: Mikkel Laursen Date: Wed, 9 Mar 2022 15:19:37 -0700 Subject: [PATCH] chore(website): Fix tooltip dense demo --- .../Demos/Tooltip/DenseTooltipsWrapper.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/documentation/src/components/Demos/Tooltip/DenseTooltipsWrapper.tsx b/packages/documentation/src/components/Demos/Tooltip/DenseTooltipsWrapper.tsx index 2ced960ce4..7bd90be7f6 100644 --- a/packages/documentation/src/components/Demos/Tooltip/DenseTooltipsWrapper.tsx +++ b/packages/documentation/src/components/Demos/Tooltip/DenseTooltipsWrapper.tsx @@ -9,23 +9,23 @@ interface CSSVariable { const VARIABLES: CSSVariable[] = [ { - name: "rmd-tooltip-font-size", + name: "--rmd-tooltip-font-size", value: scssVariables["rmd-tooltip-font-size"], }, { - name: "rmd-tooltip-line-height", + name: "--rmd-tooltip-line-height", value: scssVariables["rmd-tooltip-line-height"], }, { - name: "rmd-tooltip-min-height", + name: "--rmd-tooltip-min-height", value: scssVariables["rmd-tooltip-min-height"], }, { - name: "rmd-tooltip-horizontal-padding", + name: "--rmd-tooltip-horizontal-padding", value: scssVariables["rmd-tooltip-horizontal-padding"], }, { - name: "rmd-tooltip-vertical-padding", + name: "--rmd-tooltip-vertical-padding", value: scssVariables["rmd-tooltip-line-wrap-vertical-padding"], }, ]; @@ -47,9 +47,7 @@ export default function DenseTooltipsWrapper({ const mode = useUserInteractionMode(); const enableVariables = (): void => { - if (!variables.length) { - setVariables(VARIABLES); - } + setVariables(VARIABLES); }; useEffect(() => { @@ -61,7 +59,8 @@ export default function DenseTooltipsWrapper({ if ( !container.current || !event.target || - !container.current.contains(event.target as Node) + !(event.target instanceof Node) || + !container.current.contains(event.target) ) { setVariables([]); }