Browse Source

selectFeed: scroll feed tree to selected row

Andrew Dolgov 1 year ago
parent
commit
3827e5b944
1 changed files with 10 additions and 1 deletions
  1. 10 1
      js/FeedTree.js

+ 10 - 1
js/FeedTree.js

@@ -270,8 +270,17 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
 				this.focusNode(treeNode);
 
 				// focus headlines to route key events there
-				setTimeout(function() {
+				setTimeout(() => {
 					$("headlines-frame").focus();
+
+					const node = treeNode.rowNode;
+					const tree = this.domNode;
+
+					// scroll tree to selection if needed
+					if (node.offsetTop < tree.scrollTop || node.offsetTop > tree.scrollTop + tree.clientHeight) {
+						$("feedTree").scrollTop = node.offsetTop;
+					}
+
 				}, 0);
 			}
 		},