20031: Try to fix unit test
authorStephen Smith <stephen@curii.com>
Wed, 31 May 2023 13:50:30 +0000 (09:50 -0400)
committerStephen Smith <stephen@curii.com>
Wed, 31 May 2023 13:50:30 +0000 (09:50 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/components/tree/tree.tsx

index 9c001e7a730928791eae6a2f28f5dbc07b537468..28f1966aa173264b627c03a75651b39bb4ccb2c9 100644 (file)
@@ -317,7 +317,7 @@ export const Tree = withStyles(styles)(
         // Scroll to selected item whenever it changes, accepts selectedRef from props for recursive trees
         const [cachedSelectedRef, setCachedRef] = useState<HTMLDivElement | null>(null)
         const selectedRef = props.selectedRef || useCallback((node: HTMLDivElement | null) => {
-            if (node && node !== cachedSelectedRef) {
+            if (node && node.scrollIntoView && node !== cachedSelectedRef) {
                 node.scrollIntoView({ behavior: "smooth", block: "center" });
             }
             setCachedRef(node);