From 19366220aabeeb6fcdac6fa056b9b0e9585e8e6b Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 1 Apr 2022 10:34:09 -0400
Subject: fixed up document focus to take a collectkon so that the treeView can
 focus on the matching alias when multiple aliases are shown in different
 collections.

---
 src/client/views/PropertiesDocContextSelector.tsx | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/client/views/PropertiesDocContextSelector.tsx')

diff --git a/src/client/views/PropertiesDocContextSelector.tsx b/src/client/views/PropertiesDocContextSelector.tsx
index 4d803f992..015e0c8ee 100644
--- a/src/client/views/PropertiesDocContextSelector.tsx
+++ b/src/client/views/PropertiesDocContextSelector.tsx
@@ -4,6 +4,7 @@ import * as React from "react";
 import { Doc, DocListCast } from "../../fields/Doc";
 import { Id } from "../../fields/FieldSymbols";
 import { Cast, NumCast, StrCast } from "../../fields/Types";
+import { DocFocusOrOpen } from "../util/DocumentManager";
 import { CollectionDockingView } from "./collections/CollectionDockingView";
 import { CollectionViewType } from "./collections/CollectionView";
 import { DocumentView } from "./nodes/DocumentView";
@@ -32,12 +33,14 @@ export class PropertiesDocContextSelector extends React.Component<PropertiesDocC
     }
 
     getOnClick = (col: Doc, target: Doc) => {
+        if (!this.props.DocView) return;
         col = Doc.IsPrototype(col) ? Doc.MakeDelegate(col) : col;
         if (col._viewType === CollectionViewType.Freeform) {
             col._panX = NumCast(target.x) + NumCast(target._width) / 2;
             col._panY = NumCast(target.y) + NumCast(target._height) / 2;
         }
         this.props.addDocTab(col, "toggle:right");
+        setTimeout(() => DocFocusOrOpen(Doc.GetProto(this.props.DocView!.props.Document), col), 100);
     }
 
     render() {
-- 
cgit v1.2.3-70-g09d2

