Skip to content

Commit 4ec8037

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP: dim on keyboard navigation
This CL adds the dimming for the selected row in the 1/3P entity table to act just as it does when the user hovers with the mouse. This means that keyboard users navigating the row will see the effect without having to use a mouse. Fixed: 392667080 Change-Id: Ieacb4da337e6c255c313eb3d927bf932a69864e9 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6219151 Reviewed-by: Andres Olivares <[email protected]> Commit-Queue: Andres Olivares <[email protected]> Commit-Queue: Jack Franklin <[email protected]> Auto-Submit: Jack Franklin <[email protected]>
1 parent 255c9eb commit 4ec8037

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

front_end/panels/timeline/ThirdPartyTreeView.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import type * as Common from '../../core/common/common.js';
56
import * as i18n from '../../core/i18n/i18n.js';
67
import * as Trace from '../../models/trace/trace.js';
78
import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
@@ -54,6 +55,14 @@ export class ThirdPartyTreeViewWidget extends TimelineTreeView.TimelineTreeView
5455
this.dataGrid.expandNodesWhenArrowing = false;
5556
}
5657

58+
override wasShown(): void {
59+
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.#onDataGridSelectionChange, this);
60+
}
61+
62+
override childWasDetached(_widget: UI.Widget.Widget): void {
63+
this.dataGrid.removeEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.#onDataGridSelectionChange);
64+
}
65+
5766
override buildTree(): Trace.Extras.TraceTree.Node {
5867
const parsedTrace = this.parsedTrace();
5968
const entityMapper = this.entityMapper();
@@ -171,6 +180,16 @@ export class ThirdPartyTreeViewWidget extends TimelineTreeView.TimelineTreeView
171180
}
172181
}
173182

183+
/**
184+
* This event fires when the user selects a row in the grid, either by
185+
* clicking or by using the arrow keys. We want to have the same effect as
186+
* when the user hover overs a row.
187+
*/
188+
#onDataGridSelectionChange(
189+
event: Common.EventTarget.EventTargetEvent<DataGrid.DataGrid.DataGridNode<TimelineTreeView.GridNode>>): void {
190+
this.onHover((event.data as TimelineTreeView.GridNode).profileNode);
191+
}
192+
174193
override onHover(node: Trace.Extras.TraceTree.Node|null): void {
175194
const entityMappings = this.entityMapper();
176195
if (!entityMappings || !node?.event) {

0 commit comments

Comments
 (0)