c0c8d67a8b251e347ce93446991664202722c966
angie
  Wed Apr 27 11:40:06 2016 -0700
Scrolling the tree to the selected genome wasn't happening on page load because tree wasn't yet visible -- scroll after .show().  refs #15277

diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js
index 2ba5e86..6fe61b0 100644
--- src/hg/js/hgGateway.js
+++ src/hg/js/hgGateway.js
@@ -1126,41 +1126,40 @@
         // If dbDbTree is nonempty and SVG is supported, draw the tree; if SVG is not supported,
         // use the space to suggest that the user install a better browser.
         // If dbDbTree doesn't exist, leave the "Represented Species" section hidden.
         var svg, spTree, stripeTops;
         if (dbDbTree) {
             if (document.createElementNS) {
                 // Draw the phylogenetic tree and do layout adjustments
                 svg = document.getElementById('speciesTree');
                 spTree = speciesTree.draw(svg, dbDbTree, uiState.hubs,
                                           { onClickSpeciesName: 'hgGateway.onClickSpeciesLabel',
                                             onClickHubName: 'hgGateway.onClickHubName',
                                             hgHubConnectUrl: 'hgHubConnect?hgsid=' + window.hgsid,
                                             containerWidth: $('#speciesPicker').width()
                                             });
                 setSpeciesPickerSizes(spTree.width, spTree.height);
-                highlightLabelForDb(uiState.db, uiState.taxId);
                 stripeTops = rainbow.draw(svg, dbDbTree,
                                           spTree.yTree, spTree.height, spTree.leafTops);
             } else {
                 $('#speciesTreeContainer').html(getBetterBrowserMessage);
             }
             $('#representedSpeciesTitle').show();
             $('#speciesGraphic').show();
             if (dbDbTree && document.createElementNS) {
-                // This needs to be done after things are visible so the slider gets the
-                // right position.
+                // These need to be done after things are visible because heights are 0 when hidden.
+                highlightLabelForDb(uiState.db, uiState.taxId);
                 initRainbowSlider(spTree.height, rainbow.colors, stripeTops);
             }
         }
     }
 
     function addCommasToPosition(pos) {
         // Return seqName:start-end pos with commas inserted in start and end as necessary.
         var posComma = pos;
         var fourDigits = /(^.*:.*[0-9])([0-9]{3}\b.*)/;
         var matches = fourDigits.exec(posComma);
         while (matches) {
             posComma = matches[1] + ',' + matches[2];
             matches = fourDigits.exec(posComma);
         }
         return posComma;