Bug 1456756 - Select parent row if available when ArrowLeft is pressed on collapsed or non-expandable row. r=Honza, a=RyanVM
authorYura Zenevich <yura.zenevich@gmail.com>
Mon, 28 May 2018 15:45:02 -0400
changeset 473553 5db81a8b00dcc9e484c76d4084128f176484bc3a
parent 473552 228c94554dc0c2b5e4e1dac285d38d97fe778614
child 473554 e3eff86e40b14c2d56afc6ef0301c510f74eafa6
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza, RyanVM
bugs1456756
milestone61.0
Bug 1456756 - Select parent row if available when ArrowLeft is pressed on collapsed or non-expandable row. r=Honza, a=RyanVM MozReview-Commit-ID: 74LXTQcj8H9
devtools/client/shared/components/tree/TreeView.js
--- a/devtools/client/shared/components/tree/TreeView.js
+++ b/devtools/client/shared/components/tree/TreeView.js
@@ -264,16 +264,22 @@ define(function(require, exports, module
           let { hasChildren, open } = row.props.member;
           if (hasChildren && !open) {
             this.toggle(this.state.selected);
           }
           break;
         case "ArrowLeft":
           if (row && row.props.member.open) {
             this.toggle(this.state.selected);
+          } else {
+            let parentRow = this.rows.slice(0, index).reverse().find(
+              r => r.props.member.level < row.props.member.level);
+            if (parentRow) {
+              this.selectRow(parentRow);
+            }
           }
           break;
         case "ArrowDown":
           let nextRow = this.rows[index + 1];
           if (nextRow) {
             this.selectRow(nextRow);
           }
           break;